So, I found this nice little query:
Select count(*)
FROM Table_X
WHERE year(DATE) = '2012'
GROUP BY month(DATE)
Which does almost exactly what I need.. Except I need to query the data of current month, up until 1 year ago. So for October, sept, aug, jul, jun, may, apr, mar, feb, jan 2012 and dec, nov 2011..
So I could just wait till the end of december to make the report 🙂 . But there must be some other way?
Try using DATEADD to calculate the date 12 months ago:
If the problem is more complicated than this, post it and I’ll add to my answer.