Q&A about the site for expert genealogists and people interested in genealogy or family history
DECLARE @endDate DATE = GETDATE(); SELECT DATEADD(WEEK, DATEDIFF(WEEK, 0, CreationDate), 0) AS WeekStart, COUNT(*) AS PostCount FROM Posts WHERE PostTypeId = 1 -- 1 for questions, 2 for answers AND CreationDate <= @endDate GROUP BY DATEADD(WEEK, DATEDIFF(WEEK, 0, CreationDate), 0) ORDER BY WeekStart;