Q&A for people studying math at any level and professionals in related fields
SELECT DATEADD(hour, DATEDIFF(hour, 0, CreationDate), 0) AS Hour, COUNT(*) AS NumberOfPosts FROM Posts WHERE CreationDate > DATEADD(week, -70, GETDATE()) -- This filters out posts older than 4 weeks GROUP BY DATEADD(hour, DATEDIFF(hour, 0, CreationDate), 0) ORDER BY Hour;