Q&A for administrators and users of the CiviCRM Constituent Relationship Management software
SELECT year(Posts.ClosedDate) as y, month(Posts.ClosedDate) as m, cast (year(Posts.ClosedDate) as varchar(10)) + '/' + cast(month(Posts.ClosedDate) as varchar(19)) as ym, count(CONCAT ('http://programmers.stackexchange.com/q/', Posts.Id)) as Questions FROM PostHistory JOIN Posts ON Posts.Id = PostHistory.PostId WHERE Posts.ClosedDate >= '2012-01-01' --AND Posts.ClosedDate < '2012-12-01' AND PostHistoryTypeId = 10 AND PostHistory.Comment != 1 group by year(Posts.ClosedDate), month(Posts.ClosedDate) ORDER BY 1 desc, 2 desc