Ver originalSET @t:=0;SELECT fechemis,numdoc,codicont,debe,haber,(SELECT @t:=@t+(debe-haber)) saldo FROM comprobd WHERE codicont='2110001001' ORDER BY fechemis;