distinct count

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




Answer this question

distinct count

  • KirkAtCenterstance

    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...



  • Shawnmcf

    Select

    Employee.EmployeeName,
    Employee.EmployeeNo,


  • Dottj

    Select EmployeeName, EmployeeNo, Count(*) As NoOfDays

    From EmployeeShift

    Where Month = @Month And Year = @Year

    Group By EmployeeName, EmployeeNo



  • distinct count