Untitled

 avatar
unknown
plain_text
2 years ago
269 B
5
Indexable
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'
Editor is loading...