I have a field A
and would want to calculate field B
as follows:
B is a running total of A. Every time the running total goes over 900, B should restart its running total from 0 in the next row, as shown:
A B
37 37
427 464
17101 17565
30 30 //Restart here because the previous value of B was >900
70 100
788 888
30 918
30 30
30 60
30 90
1120 1210
30 30
30 60
30 90
30 120
How can I get to derive B
in Sybase?