Untitled

From Rude Sloth, 2 Months ago, written in Plain Text, viewed 77 times.
URL http://codebin.org/view/e19781b8 Embed
Download Paste or View Raw
  1. with pob as
  2. (select date_trunc('month', created_at)::date as dt,
  3.         SUM(costs)
  4. from tools_shop.costs c
  5. group by dt
  6. order by dt)
  7.  
  8. select pob.dt, pob.sum,
  9.     (pob.sum - lag(pob.sum) over (order by pob.dt)) as delta
  10. from pob

Reply to "Untitled"

Here you can reply to the paste above