I have table like this.
existing condition
+----+------+-----+
| x  |   a  |  b  |
+----+------+-----+
| 1  |   3  |  0  |
| 3  |   6  |  0  |
| 7  |   2  |  0  |
| 12 |  -1  |  0  |
| 16 |   8  |  0  |
| 23 |  -6  |  0  |
| 28 |   4  |  0  |
+----+------+-----+
Column x is a Date data type, it must ordered by date.
My question is, i want column b have the value that satisfy
b = a + b'
where b' is the value before the updated record
expected condition
+----+------+------+
| x  |   a  |   b  |
+----+------+------+
| 1  |   3  |   3  |
| 3  |   6  |   9  |
| 7  |   2  |  11  |
| 12 |  -1  |  10  |
| 16 |   8  |  18  |
| 23 |  -6  |  12  |
| 28 |   4  |  16  |
+----+------+------+
for x=1, b=3 because it is the first data
for x=3, b=9 because a=6 and last b=3 so (6 + 3)
...
for x=16, b=18 because a=8 and last b=10 so (8 + 10)
...
and so on.
How do i update the column b with single update statement?
Is that possible?
 
     
     
    