Create “Select” statement with calculated column from previous row
Hello,
I have the following dates:
Row-No. Qty Total
1 -11 39
2 -9 30
3 10 40
4 -1 39
5 -2 37
6 -2 35
7 5 40
.....
.....
In the first line for calculating value in the "Total" column (39), we add the value from column "Qty" (-11) to the value from a DB function "get_act_value" (value = 50) --> (50+(-11)= 39).
Then from the second line to calculate the value in the "Total" column, we take the value in this column in the previous line and add the value from current column "Qty". (For Line 2: 39(from previous row) + (-9) = 30, and so on).
Is there a possibility to output this logic as a Sql statement?
Thanks