Q&A for people looking to bypass life's everyday problems with simple tricks
SELECT DATEPART(YEAR, Posts.CreationDate) AS Year, DATEPART(WEEK, Posts.CreationDate) AS Week, COUNT(*) AS PostCount, AVG(Posts.Score) AS AverageScore, SUM(Posts.ViewCount) AS TotalViewCount FROM Posts WHERE Posts.CreationDate >= '2022-01-01' AND Posts.CreationDate < '2023-02-01' GROUP BY DATEPART(YEAR, Posts.CreationDate), DATEPART(WEEK, Posts.CreationDate) ORDER BY Year, Week