How can I group only by month from a date field (and not group by day)?
Here is what my date field looks like:
2012-05-01
Here is my current SQL:
select Closing_Date, Category, COUNT(Status)TotalCount from MyTable
where Closing_Date >= '2012-02-01' and Closing_Date <= '2012-12-31'
and Defect_Status1 is not null
group by Closing_Date, Category
Use the DATEPART function to extract the month from the date.
So you would do something like this:
Try the Following Code