Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
446 B
5
Indexable
Never
WITH tab as (SELECT EXTRACT(month from creation_date::date) as month, 
COUNT(id)
FROM stackoverflow.posts
WHERE creation_date >'2008-07-31' and creation_date <'2009-01-01'
GROUP BY EXTRACT(month from creation_date::date)),

tab2 as(SELECT month, count,
ROUND((((count - LAG(count) OVER (ORDER BY month))::numeric)/LAG(count) OVER ())*100,2)
FROM tab)
--WHERE month!=7 and month !=8

SELECT *
FROM tab2
WHERE month!=7 and month!=8