Q&A for linguists, teachers and learners wanting to discuss the finer points of the Portuguese language
with postM(yearm, monthm,countm,lastMonth) as ( select year(creationdate) as yearm, month(creationdate) as monthm , count(id) as countm, lag(count(id)) over(order by year(creationdate), month(creationdate)) lastMonth from posts group by year(creationdate),month(creationdate) ) select yearm, monthm, CONCAT((lastMonth-countm)/CAST(lastMonth AS DEC(12,4))*100,'%') as percents from postM where lastMonth>countm order by yearm, monthm