I want to compute running row totals across a table, however the totals must start over for new IDs
My code:
set @csum := 0;
select ID, name, marks, (@rt := @rt + marks) as Running_total from students order by ID;
The output returns the totals however doesn't break or start over for new IDs
See Question&Answers more detail:os