By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
6 rows affected
id | somedate | somevalue | run_tot | m_run_tot | required_output |
---|---|---|---|---|---|
1 | 2009-01-01 | 10000 | 10000 | 10000 | 10000 |
2 | 2009-01-08 | -100 | 9900 | 9900 | 10000 |
3 | 2009-02-02 | -200 | 9700 | -200 | 9900 |
4 | 2009-02-14 | -200 | 9500 | -400 | 9900 |
5 | 2009-02-20 | -400 | 9100 | -800 | 9900 |
6 | 2009-03-02 | -300 | 8800 | -300 | 9100 |
Warning: Null value is eliminated by an aggregate or other SET operation.