Q&A about the site for professional and enthusiast programmers
SELECT AVG(Comment_Count) AS [Average Comments], DATEPART(weekday, Last) AS Day FROM ( SELECT COUNT(*) AS Comment_Count, CAST(CreationDate AS Date) AS Day, MAX(CreationDate) AS Last FROM Comments WHERE CreationDate > DATEADD(dd, -1800, GETDATE()) GROUP BY CAST(CreationDate AS Date) ) AS Commentcounts GROUP BY DATEPART(weekday, Last) ORDER BY DATEPART(weekday, Last) ASC