Q&A for those interested in the geology, meteorology, oceanography, and environmental sciences
SELECT DATEPART(YEAR, Posts.CreationDate) Year, DATEPART(MONTH, Posts.CreationDate) Month, SUM(CASE WHEN Posts.Id = 1 THEN 1 ELSE 0 END) Questions, SUM(CASE WHEN Posts.Id = 2 THEN 1 ELSE 0 END) Answers FROM Posts WHERE PostTypeid IN (1, 2) GROUP BY DATEPART(YEAR, Posts.CreationDate), DATEPART(MONTH, Posts.CreationDate) ORDER BY Year, Month