Count questions and answers by year

1 min read Original article ↗

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

select YEAR(p.CreationDate) as Year, pt.Name, count(p.Id) as [How many posts]
from Posts p
join PostTypes pt on pt.Id = p.PostTypeId 
where p.PostTypeId in (1,2)
group by YEAR(p.CreationDate),pt.Name
order by Year asc

edited feb 7 17

created mar 17 16

Enter Parameters

Options:

Switch to meta site

loading Hold tight while we fetch your results