69latrickz
New member
- Local time
- Today, 12:22
- Joined
- Apr 6, 2021
- Messages
- 4
Hi, I am looking for help to solve a query problem. I have a table called OPERATIONS with the following fields : N_Operation (which is the ID of the transaction), N_de_compte (which is the ID of the account that initiated the transaction), Credit, Debit. So every user can make multiples transactions. wanted to have running total so I wrote the following SQL :
SELECT OPERATIONS.N_Operation, OPERATIONS.N_de_compte, OPERATIONS.Montant_credit, OPERATIONS.Montant_debit, DSum(" [Montant_debit]","OPERATIONS","N_Operation<=" & [N_Operation]) AS DEB, DSum(" [Montant_credit]","OPERATIONS","N_Operation<=" & [N_Operation]) AS CRED, [CRED]-[DEB] AS BALANCE
FROM OPERATIONS;
It works perfectly, but I can't find a way to make it calculate the balances for each account and not for all the accounts together.
Thank you in advance for your help.
(Sorry for my english)
SELECT OPERATIONS.N_Operation, OPERATIONS.N_de_compte, OPERATIONS.Montant_credit, OPERATIONS.Montant_debit, DSum(" [Montant_debit]","OPERATIONS","N_Operation<=" & [N_Operation]) AS DEB, DSum(" [Montant_credit]","OPERATIONS","N_Operation<=" & [N_Operation]) AS CRED, [CRED]-[DEB] AS BALANCE
FROM OPERATIONS;
It works perfectly, but I can't find a way to make it calculate the balances for each account and not for all the accounts together.
Thank you in advance for your help.
(Sorry for my english)