Untitled

From Sole Gorilla, 3 Months ago, written in Plain Text, viewed 51 times.
URL http://codebin.org/view/5deae676 Embed
Download Paste or View Raw
  1. WITH k AS (
  2.            SELECT CAST(DATE_TRUNC('month', created_at) AS date),
  3.            SUM(costs) OVER(PARTITION BY CAST(DATE_TRUNC('month', created_at) AS date) ORDER BY costs)
  4.            FROM tools_shop.costs)
  5.            SELECT *
  6.            FROM k
  7.            WHERE DATE_TRUNC BETWEEN '2017-01-01' AND '2018-12-31'
  8.          

Reply to "Untitled"

Here you can reply to the paste above