Is it possible to do a running balance?
I'm currently doing a report that does a T ledger. It needs to do a running balance from a known start point. I'm trying to migrate the logic for this into SQL as much as possible and querying a running balances is something I haven't figured out...
As can be seen, the balance of each row id dependent on the contents of the row that preceded it. This information is NOT precalculated at insert time nor can it be since the ledger needs to reflect changes brought by query filters that determine which rows show up. So, can this be done in SQL alone?
Credit Debit Balance
start -- -- 100.00
row1 10.00 110.00
row2 20.00 90.00
row3 10.00 100.00