Это 1 задача на sql, не тот вывод

This commit is contained in:
Aysat
2025-11-26 12:11:48 +06:00
parent a6c0cde36c
commit 0d12df9572
+19
View File
@@ -0,0 +1,19 @@
with cte1 as (
select count(distinct(user_id)) as mau,
date_trunc('month', date) as month
from abakhytbekuly.users
group by date_trunc('month', date)
),
cte2 as (
select mau,
month,
lag(mau) over(order by month) as prev_mau
from cte1
)
select mau,
month,
prev_mau,
100.0 * (mau - prev_mau) / prev_mau as pct_change
from cte2
order by month