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 m
You can do this by using Year(), Month() Day() and datepart().
In you example this would be:
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 Year(Closing_Date), Month(Closing_Date), Category