I have an Oracle db and a table and I'd want to sum the VAL column until I have the value in column SUMM 100 and the difference in column DIF - as in this example:
ID VAL SUMM DIF
1 40 40 0
2 20 60 0
3 30 90 0
4 15 100 5
5 22 0 27
How can I do this? Thanks!
diff
calculated? Thesumm
column is easy:sum(val) over (order by id)