Query issue

Database
Enthusiast

Query issue

Hi

Hi,

I will have master contract which will have more than one accounts(some times it will have only one account).

In Baln_fi_acct contain previou eod the balance for each account.

I need every day it should take the previous balance from the Baln_fi_acct table and add to the Balance AGGREGATE SNAP ACCOUNT BALANCE column(see second table)

Same like debit balance should be added to the Debit Balance(AGGREGATE DEBIT SNAP ACCOUNT BALANCE).

Can you please let me know the logic

Baln_fi_acct:
Account EOD BALN(ACCT_AMT_ACCT_CNCY)
1234 $1,000
1235 ($3,500)
1236 ($1,500)
Total ($4,000)

Account Transaction Time Amount(PAYT_ITEM_CURR.AMT_IN_ACCT_CNCY) Balance(AGGREGATE SNAP ACCOUNT BALANCE) Debit Balance(AGGREGATE DEBIT SNAP ACCOUNT BALANCE) Credit Balance(AGGREGATE CREDIT SNAP ACCOUNT BALANCE)
1234 2:45 $2,500 ($1,500) ($5,000) $3,500
1235 7:15 ($2,800) ($4,300) ($7,800) $3,500
1234 8:45 $900 ($3,400) ($7,800) $4,400
1236 11:50 ($1,900) ($5,300) ($9,700) $4,400
1234 16:00 ($700) ($6,000) ($9,700) $3,700
1236 19:00 $2,000 ($4,000) ($7,700) $3,700
1236 22:00 $500 ($3,500) -$7200 $3,700

1 REPLY
Enthusiast

Re: Query issue


Account Transaction Time Amount(PAYT_ITEM_CURR.AMT_IN_ACCT_CNCY) Balance(AGGREGATE SNAP ACCOUNT BALANCE)
1234 02:45 $2500 -$1500
1235 07:15 -$2800 -$4300
1234 08:45 $900 -$3400
1236 11:50 -$1900 -$5300
1234 16:00 -$700 -$6000
1236 19:00 $2000 -$4000
1236 22:00 $500 -$3500