Myslím, že tento dotaz bude fungovat:
select id,type,amount,(select sum(amount) from mytable t1 where t1.type=t2.type and t1.id<=t2.id) currenttotal from mytable t2
Myslím, že tento dotaz bude fungovat:
select id,type,amount,(select sum(amount) from mytable t1 where t1.type=t2.type and t1.id<=t2.id) currenttotal from mytable t2