I have a table like this
+------+--------+
| ID | Salary |
+------+--------+
| 1 | 100 |
| 2 | 40 |
| 3 | 30 |
| 4 | 40 |
| 5 | 90 |
| 6 | 160 |
| 7 | 70 |
| 8 | 40 |
| 9 | 20 |
| 10 | 10 |
| 11 | 200 |
| 12 | 50 |
+------+--------+
I can make normal cumulative sum but i need something different from normal CUMULATIVE SUM
. If the cumulative sum is %50
higher than the last sum, for the next cumulative sums start from this value
+------+--------+---------------+
| ID | Salary | Running Total |
+------+--------+---------------+
| 1 | 100 | 100 |
| 2 | 40 | 140 |
| 3 | 30 | 170 |
| 4 | 40 | 210 |
| 5 | 90 | 300 |
| 6 | 160 | 460 |
| 7 | 70 | 230 |
| 8 | 40 | 270 |
| 9 | 20 | 290 |
| 10 | 10 | 300 |
| 11 | 200 | 500 |
| 12 | 50 | 250 |
+------+--------+---------------+
I want a output like this.