Windows 7 - Hi, I'm try to sum the total of employess who have com to work for 31 days, to caputur i w

Asked By Shamina S on 13-Jun-12 01:25 AM
Raman S V replied to Shamina S on 13-Jun-12 01:38 AM
Hi,
Try the below query :

select COUNT(EmployeeName) from Employees where DaysWorked = 31

Regards,
Raman S V
Chintan Vaghela replied to Shamina S on 13-Jun-12 02:24 AM

Hi Frndz,

 

Functionality: Gettting total Employee based on Year, month (Whose come more than 31 days)

 

 

 

In sp Parameter declare decimal value as following way

 

@UnitPrice decimal (20,2)

 

 

 

 

Query:

 

select 

    DATENAME(month,DateField) as MonthPresent,

    DATENAME(year,DateField) as YearPresent,

    EmployeeName, 

    COUNT(*) as TotalEmployee

from

    TableName

Group By

    DATENAME(month,DateField),

    DATENAME(year,DateField),

    EmployeeName

having COUNT(*) > 31

 

 

Hope this helpful!

Thanks

 

 

 

Chintan Vaghela replied to Shamina S on 13-Jun-12 02:25 AM

Hi Frndz,

 

Functionality: Gettting total Employee based on Year, month (Whose come more than 31 days)

 

Group by using MonthName, Year, Employee based on Count greater then 31

 

 

Query:

 

select 

    DATENAME(month,DateField) as MonthPresent,

    DATENAME(year,DateField) as YearPresent,

    EmployeeName, 

    COUNT(*) as TotalEmployee

from

    TableName

Group By

    DATENAME(month,DateField),

    DATENAME(year,DateField),

    EmployeeName

having COUNT(*) > 31

 

 

Hope this helpful!

Thanks