Ending balance and begining balance

  • I have a situation like this. Daily income, daily outcome are the measures. The ending balance=begining balance+total income-total outcome. For the first day, begining balance is zero but there should be ending balace and from next day onwards the previous day ending balance is today's begining balance. Do anyone have any idea how to solve this issue? Please reply to me ASAP. It is very very urgent.

    Thanks in advance,

    Anbu

  • This was removed by the editor as SPAM

  • You can use the following query.

    
    
    SELECT t1.bal_date,
    (SELECT sum(income - outcome)
    FROM your_table t2
    WHERE t2.bal_date <= t1.bal_date)
    FROM your_table t1

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply