select t3.y as yearr, t3.m as monthh, t3.pr as percentt f...

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 t3.y as yearr, t3.m as monthh, t3.pr as percentt
from (select t2.y as y, t2.m as m,
case when t2.c<t2.pred then (t2.pred-t2.c)*100/t2.pred end as pr
from (select t1.y as y, t1.m as m, t1.c as c,
(lag(t1.c) over (order by t1.y, t1.m)) as pred
from (select year(creationdate) as y, month(creationdate) as m, count(*) as c
from posts where posttypeid between 1 and 2
group by year(creationdate), month(creationdate)) as t1) as t2) as t3
where t3.pr is not null

Enter Parameters

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