Yearly stats

2

Please login or register to vote for this query.

(click on this box to dismiss)

LEGO® Answers

Q&A for LEGO® and building block enthusiasts

select datepart(year, CreationDate) year,
       sum(iif(PostTypeId = 1, 1, 0)) questions,
       sum(iif(PostTypeId = 2, 1, 0)) answers
from Posts
group by datepart(year, CreationDate)
order by datepart(year, CreationDate);

select datepart(year, CreationDate) year,
       sum(iif(PostTypeId = 1, 1, 0)) questions,
       sum(iif(PostTypeId = 2, 1, 0)) answers
from PostsWithDeleted p
group by datepart(year, CreationDate)
order by datepart(year, CreationDate);

select datepart(year, ph.CreationDate) year,
       count(*) Edits
from PostHistory ph
     join Posts p on p.Id = PostId
where PostHistoryTypeId = 5 -- "Edit Body"
      and PostTypeId in (1,2) -- questions and answers
group by datepart(year, ph.CreationDate)
order by datepart(year, ph.CreationDate);

select datepart(year, CreationDate) year,
       count(*) comments
from Comments
group by datepart(year, CreationDate)
order by datepart(year, CreationDate);

select datepart(year, CreationDate) year,
       count(*) comments
from Comments
group by datepart(year, CreationDate)
order by datepart(year, CreationDate);

Enter Parameters

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