I want to get carry forward a field value using another field
This is my table transaction
------------------------------
id | amount | is_income |
------------------------------
1 | 400 |1
2 | 100 |0
3 | 300 |1
I want to get the result like
--------------------------------------
id | amount | is_income |Balance |
--------------------------------------
1 | 400 |1 | 400
2 | 100 |0 | 300
3 | 300 |1 | 600
If is_income field is 1 then add amount with previous amount. and if is_income field is 0 then subtract with previous amount.
if any method to get result without stored procedure ?