SELECT AVG(Comment_Count) AS [Average Comments], DATEPAR...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Meta Stack Overflow

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

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results