Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- WITH
- pz AS (SELECT *,
- DATE_TRUNC('month', created_at)::date AS month_of_costs,
- SUM(costs) OVER (
- ORDER BY DATE_TRUNC('month', created_at)) AS total_amt
- FROM tools_shop.costs)
- SELECT DISTINCT month_of_costs, total_amt
- FROM pz
- WHERE EXTRACT(
- YEAR FROM month_of_costs) IN (2017,2018)
Advertisement
Add Comment
Please, Sign In to add comment