select Anno, Mese, Totale, Saldo=Totale+isnull((select sum(t2.Totale) from TUATABELLA t2 where (t2.anno*12+t2.mese)<(t1.anno*12+t1.mese)),0) from TUATABELLA t1 order by anno,mese