Using windows function
I have a table with 4 columns. Namely accit qtyd qtyr run total I have tried this so far SUM(qtyd-qtdr)FILTER (WHERE t1.accit = t1min.accit)OVER (ORDER BY t1.accit ROWS UNBOUNDED PRECEDING)AS RUNtotal The problem is that it is doing a running total but for all. I need it to do per accit and then the next accit
- 5. 2. 3
- 2. 1. 4
- 5. 1 8 ( here it should be 4 as it is a new accit)
Please help as to where I am going wrong.
(2) By David Raymond (dvdraymond) on 2020-09-10 15:48:25 in reply to 1 [link] [source]
I think you need a "partition by" in there ... over (partition by t1.accit order by... ...but I'm not the most familiar with window functions