ghx8

runsum

Mar 28th, 2018
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 0.29 KB | None | 0 0
  1. select date, sum(amount), sum(sum(amount)) over (order by date) from
  2. (select ref date,amount, amount amtmx, 0 amtrk from rk where ctg='str' and db='01nrg' and ref is not null
  3. union all select date,-amount, 0, amount amtrk from rk where ctg='str' and db='01nrg' and ref is not null) t
  4. group by date
Advertisement
Add Comment
Please, Sign In to add comment