Gopneg
public text v1 · immutableselect sum(rat), dat
from
( select distinct (s.dateexec) dat, 1 rat, summ
from
( select sum(coddoc) summ, one.dateexec dat
from stkdocs one
where one.coddoc < 120000
group by one.dateexec
order by one.dateexec) two,
stkdocs s
where two.dat <= s.dateexec
and s.coddoc < 120000) thr
group by thr.dat
order by thr.dat