Q&A about the site for practitioners, researchers, and students in cognitive science, psychology, neuroscience, and psychiatry
SELECT year(p1.ClosedDate) as y
, month(p1.ClosedDate) as m
, cast (year(p1.ClosedDate) as varchar(10)) + '/' + cast(month(p1.ClosedDate) as varchar(19)) as ym
, count(p1.Id) as ClosedQuestions
, count(p2.Id) as TotalQuestions
LEFT OUTER JOIN Posts AS p2 ON p2.Id = PostHistory.PostId
JOIN Posts AS p1 ON p1.Id = PostHistory.PostId
WHERE p1.ClosedDate >= '2012-01-01'
--AND Posts.ClosedDate < '2012-12-01'
AND PostHistoryTypeId = 10
AND PostHistory.Comment != 1
group by year(p1.ClosedDate), month(p1.ClosedDate)
ORDER BY 1 desc, 2 desc