As more cobwebs and dust fall away . . . First impose a (temporary?) index column, idx, ordering the transactions, with a step of 1. And then you do something like UPDATE theTable SET tBal=tBal(idx -1) + charge WHERE idx > MIN(idx);