I have the following typically horrible bit of SQL to get a result I want:-
SELECT Date, Description, Credit, (SELECT SUM(Credit) FROM jessica j2 WHERE j2.Date <= j1.Date ORDER BY j2.Date) AS TotCredit FROM jessica j1;
This is actually slightly simplifed but illustrates the problem. It works OK if run as shown but unfortunately I don't actually have the ability to create the whole thing in the application where I'm using it. All I can do is specify the SQL for the individual selected colums, I *can't* specify the final "FROM jessica j1", it's actually just "FROM jessica".
So, what the application executes is:-
SELECT Date, Description, Credit, (SELECT SUM(Credit) FROM jessica j2 WHERE j2.Date <= Date ORDER BY Date) AS TotCredit FROM jessica
I can change the (SELECT SUM(Credit) FROM jessica j2 WHERE j2.Date <= Date ORDER BY Date) to anything I want, can anyone suggest a way to get the running total that I want just by adjusting this part of the SQL?