Untitled

Anonymous
plain_text
07/28/2023 12:51 PM
360 B
19
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...