with postCountByMonths as (select year(creationdate) as y...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Computer Science Educators

Q&A for those involved in the field of teaching Computer Science

with postCountByMonths as
(select year(creationdate) as year, month(creationdate) as month, coalesce(count(*), 0) as count
from posts
where posttypeid = 1 or posttypeid = 2
group by year(creationdate), month(creationdate))

select curr.year, curr.month, curr.count, prev.year, prev.month, prev.count
from postCountByMonths as curr join postCountByMonths as prev on
    datediff(month, DATEFROMPARTS(curr.year, curr.month, 1), DATEFROMPARTS(prev.year, prev.month, 1)) = 1
order by curr.year, curr.month

Enter Parameters

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