Count of posts by month

0

Please login or register to vote for this query.

(click on this box to dismiss)

Simple count of posts by month

Stack Overflow

Q&A for professional and enthusiast programmers

-- Count of posts by month
-- Simple count of posts by month
select top 10 (datepart(year, p.creationdate) * 12) + datepart(month, p.creationdate) as yearmonth,
count(*) as postcount,
sum(score) as the_score,
sum(score) / cast(count(*) as float) as score_per_post
from posts p
group by datepart(year, p.creationdate),
datepart(month, p.creationdate)
order by datepart(year, p.creationdate),
datepart(month, p.creationdate)

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results