Sql statement for cumulative sum.
Hello guys, how are you doing?
Thanks for the time answering this.
I want to make a cumulative sum using a sql statement. Can you help me telling whats the error in this formula:
select t."data da operação",t."Cliente", (select sum(x."saldo inicial") + IF(x."TIPO"='SALDO INICIAL',0,if(sum(x."
Quantidade")=0,sum(x."profit"),0)) as teste from "Futura Completo" x
where x."DATA DA OPERAÇÃO"<= t."DATA DA OPERAÇÃO") as "Patrimônio"
from "Futura Completo" t
order by t."DATA DA OPERAÇÃO"
?
Tks Guys
Leonardo Hermoso