From: http://goo.gl/LfvLO The following queries group the result set by month:
select Year(CreatedOnUTC), Month(CreatedOnUTC), COUNT(1) cont from ServiceLog group by Year(CreatedOnUTC), Month(CreatedOnUTC) order by Year(CreatedOnUTC) desc, Month(CreatedOnUTC) desc
select dateadd(month, datediff(month, 0, CreatedOnUTC),0), COUNT(1) cont from ServiceLog group by dateadd(month, datediff(month, 0, CreatedOnUTC),0) order by dateadd(month, datediff(month, 0, CreatedOnUTC),0) desc
"Group by Date SQL Query"
No comments yet. -