Hi! I have a problem with a project I am working on. I have a database table containing financial transactions:
id account date description amount_in amount_out I filter the table based on things like account, date ranges etc and then show the results in a DBGrid. The user can click on a column to change the sort. I need to show the current balance on each row so: balance = previous_balance + (amount_in - amount_out) This isn't a big problem until the user scrolls the grid or changes the sort field, then the balance column changes as the balance on the previous row is wrong. There are only two solutions I can think of: Add a balance field to the table and update it as needed, which is fine until the user modifies a very early transaction and has to wait as all the more recent ones are updated. The other idea is to do a select statement to calculate the balance of all the transactions that has an earlier date of the row being processed. This is great for a few dozen rows but really slow when there are thousands of rows to display. I would really appreciate any other ideas or comments.

