Untitled
unknown
plain_text
3 years ago
336 B
4
Indexable
WITH
gr_mon AS (SELECT CAST(DATE_TRUNC('month', created_at) AS date) AS month,
SUM(costs) AS month_cost
FROM tools_shop.costs
GROUP BY month)
SELECT *,
month_cost - LAG(month_cost, 1, month_cost) OVER (ORDER BY month_cost) AS costs_from_previous
FROM gr_monEditor is loading...