select t.y, t.m from (select *, case when t.d<0 then '<0'...

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 t.y, t.m 
from (select *,
case when t.d<0 then '<0' end as diff
from (select t.y as y, t.m as m, (t.c-lag(t.c) over (order by t.y, t.m)) as d, 
(t.c*100/lag(t.c) over (order by t.y, t.m)) as pr
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 t) 
as t) 
as t
where t.diff='<0'


select t1.y as y, t1.m as m, (t1.c-lag(t1.c) over (order by t1.y, t1.m)) as d,
((lag(t1.c) over (order by t1.y, t1.m))-t1.c)*100/(lag(t1.c) over (order by t1.y, t1.m)) 
as pr
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

Enter Parameters

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