sql: running total by prettyscripts on 2011-10-28 10:35 • Send feedback » sql to calculate running total / balance in a single sql statment: select a.id, a.quantity, (select sum(b.quantity) from stock b where b.id <= a.id) as running_total from stock a ; more »