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 programmers

select (datepart(year, p.creationdate) * 12) + datepart(month, p.creationdate) as yearmonth,
count(*) as postcount
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