Q&A about the site for people who build and repair bicycles, people who train cycling, or commute on bicycles
DECLARE @StartDate DATE = '2009-01-01'; DECLARE @EndDate DATE = '2024-04-30'; WITH Questions AS ( SELECT Id, CreationDate, 1 AS AQuestion FROM PostsWithDeleted WHERE PostTypeId = 1 AND CreationDate >= @StartDate AND CreationDate <= @EndDate ), MonthlyCounts AS ( SELECT DATEADD(month, DATEDIFF(month, 0, CreationDate), 0) AS Month, SUM(AQuestion) AS Questions FROM Questions GROUP BY DATEADD(month, DATEDIFF(month, 0, CreationDate), 0) ) SELECT Month, Questions FROM MonthlyCounts ORDER BY Month;