select DataYear,DataMonth,cnt,prev,round(100-cnt*100.00/p...

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 DataYear,DataMonth,cnt,prev,round(100-cnt*100.00/prev,2) prc
from (
select datayear,DataMonth,cnt,lag(cnt) over (order by datayear,DataMonth) prev 
       from(
       select year(creationdate) as DataYear, month(creationdate) as DataMonth,
         count(*) as cnt 
         from posts 
         where posttypeid between 1 and 2
         group by year(creationdate), month(creationdate)
           ) as x
     )as y
where cnt<prev 
order by DataYear,DataMonth

Enter Parameters

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