Hi
I have a table which stores the shift information for employees. The table contains 10 columns as Employeename,Employeeno,month,year,shifttimings etc. If an employee works a day in a particular shift, then a row will be inserted in to the above table for that employee.
Now at the end of the month i wanted to calculate the shift details for each employee for a particular month of a given year like employeename,employeeno, noofdays(countof shiftdays).
Can some body help?
Thanks in Advance!
Santhosh
Select
Employee.EmployeeName,
Employee.EmployeeNo,
|||Select EmployeeName, EmployeeNo, Count(*) As NoOfDays
From EmployeeShift
Where Month = @.Month And Year = @.Year
Group By EmployeeName, EmployeeNo
|||You could create a view as
Select EmployeeName, EmployeeNo, Month, Year, Count(*) As NoOfDays
From EmployeeShift
Group By EmployeeName, EmployeeNo, Month, Year
and apply Where to it...
sql
No comments:
Post a Comment