lets take sample data
ID Amount1 Amount2
1 15
2 30
3 45
4 60
here amount2 is empty and we want cumulative sum in amount2 based on column amount1 , then you can use this query
update table_name as t1set amount2 = amount1 + ( select max(amount2) from table_name where id < t1.id )
No comments:
Post a Comment