Make cumulative sum in view oracle

后端 未结 2 796
难免孤独
难免孤独 2021-01-23 13:44

I want to make a view in oracle, how can I get value of \'saldo\' that I supposed like in this screenshoot with oracle? can someone give me the script?

The result that

2条回答
  •  天涯浪人
    2021-01-23 14:29

    Try this:

    SELECT DATEACCT, PERIOD_ID, STARTDATE, ENDDATE, CREDIT, DEBIT,
        SUM (DEBIT-CREDIT) OVER (ORDER BY DATEACCT,PERIOD_ID,STARTDATE,ENDDATE) saldo
    from AKUN
    ORDER BY DATEACCT, PERIOD_ID, STARTDATE, ENDDATE;
    

提交回复
热议问题