I have a table with four columns ( id , Creditor ,Debit ,Balance) I want to work
-----------------------------
| id |Creditor|Debit|Balance|
----------------------------
| 1  | 100    |null | null  |
| 2  | 50     |null | null  |
| 3  | null   | 100 | null  |
| 4  | 50     |null | null  |
| 5  | null   | 20  | null  |
| 6  | null   | 10  | null  |
| 7  | null   | 100 | null  |
| 8  | 200    |null | null  |
-----------------------------
Creditor - Debit + previous row Balance
How can I achieve this
Expected Output
 -----------------------------
| id |Creditor|Debit|Balance|
----------------------------
| 1  | 100    |null | 100   |
| 2  | 50     |null | 150   |
| 3  | null   | 100 | 50    |
| 4  | 50     |null | 100   |
| 5  | null   | 20  | 80    |
| 6  | null   | 10  | 70    |
| 7  | null   | 100 | -30   |
| 8  | 200    |null | 170   |
-----------------------------