with y_m_posts as( select year(creationDate) as y_r, mont...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Woodworking

Q&A for professional and amateur woodworkers

--сгруппируем посты по годам/месяцам
--и вычислим процент количества публикаций по сравнению
--с предыдущей срокой (месяцем)
with y_m_posts as(
  select
    year(creationDate) as y_r,
    month(creationDate) as m_h,
    round(1 - count(1) / (
                      lag(count(1)) over
                        (order by year(CreationDate),
                                  month(CreationDate))),
          2)
    as perc
  from posts
  group by year(creationDate), month(creationDate))
  
select y_r, m_h, perc
from y_m_posts

Enter Parameters

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