I have a column a_increment and I want to use it to calculate a column a_cumulative, where a_cumulative is the sum of all a_increments before (timestamp “DateTime”).
I have tried several approaches, for example an iterative approach where I calculate the new a_cumulative as the previous a_cumulative + the previous a_increment, however, this was done backwards in time, which does not yield the correct result.
I found that a window function could yield the correct result, however, window functions are not allowed in an update of the table.
Could somebody help me with this? My intuition is that using an iterative approach would be fastest, but I don’t know how to force the iteration to go forward.