Q&A for professional and enthusiast programmers
with questionsWithAnswerCount as ( SELECT p.id, max(p.CreationDate) as creationDate, count(*) as answers FROM Posts p INNER JOIN Posts a ON a.parentId = p.id and a.postTypeId = 2 WHERE p.PostTypeId = 1 GROUP BY p.id ) SELECT MIN(creationDate), COUNT(*) AS 'Questions with 1 or more answers' FROM questionsWithAnswerCount WHERE answers >= 1 GROUP BY (CAST(YEAR(creationDate) as nvarchar(4)) + '-' + CAST(MONTH(creationDate) as nvarchar(2))) ORDER BY MIN(creationDate) ASC