--group by day
SELECT COUNT(* ),
Dateadd(DAY,Datediff(DAY,0,HireDate),0) 'day'
FROM Employees
GROUP BY Dateadd(DAY,Datediff(DAY,0,HireDate),0)
ORDER BY Dateadd(DAY,Datediff(DAY,0,HireDate),0) DESC
--group by Month
SELECT COUNT(* ),
Dateadd(MONTH,Datediff(MONTH,0,HireDate),0) 'Month'
FROM Employees
GROUP BY Dateadd(MONTH,Datediff(MONTH,0,HireDate),0)
ORDER BY Dateadd(MONTH,Datediff(MONTH,0,HireDate),0) DESC
Tuesday, September 16, 2008
SQL Server programming Group by day,Month ,Year
Subscribe to:
Post Comments (Atom)
Popular Posts
|
No comments:
Post a Comment