select YearMonth, round(100-cnt*100.00/pre, 2) from (sele...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Portuguese Language

Q&A for linguists, teachers and learners wanting to discuss the finer points of the Portuguese language

select YearMonth, round(100-cnt*100.00/pre, 2)
   from 
   (select YearMonth, cnt, lag(cnt) over (order by YearMonth) as pre
  from 
  (select year(CreationDate)*100+month(CreationDate) as YearMonth, count (1) as cnt
   from posts
  where PostTypeId between 1 and 2
group by year(CreationDate)*100+month(CreationDate)
) tab
) tabl
where cnt < pre
order by YearMonth

Enter Parameters

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