Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
269 B
1
Indexable
Never
WITH amt as(
SELECT DISTINCT CAST(DATE_TRUNC('month', created_at) as date) as dt, 
SUM(costs) OVER(ORDER BY CAST(DATE_TRUNC('month', created_at) as date) )
FROM tools_shop.costs
ORDER BY dt)

SELECT dt, sum 
FROM amt
WHERE dt >= '2017-01-01' AND dt<'2019-01-01'