straatlang
Technical User
I Want to make a query and the result should calculate the total balance
per Accountnumber per Value date by entering a Value date.
Table: Movements
Value Date Accountnumber Amount Cur DR/CR
01-1-2003 123 2000 EUR CR
01-2-2003 456 1500 EUR CR
01-2-2003 123 1450 USD CR
01-4-2003 456 1250 EUR CR
01-7-2003 123 800 USD CR
15-1-2003 123 950 EUR CR
20-1-2003 789 5000 USD CR
27-1-2003 456 5000 USD CR
28-1-2003 456 3000 USD CR
29-1-2003 789 1500 USD CR
30-1-2003 123 1000 EUR DR
The expected result per value date 15-1-2003
Account Balance Currency DR/CR
123 2950 EUR CR
123 2250 USD CR
456 2750 EUR CR
The expected result per value date 31-1-2003
Account Balance Currency DR/CR
123 1950 EUR CR
123 2250 EUR CR
456 8000 USD CR
789 6500 USD CR
per Accountnumber per Value date by entering a Value date.
Table: Movements
Value Date Accountnumber Amount Cur DR/CR
01-1-2003 123 2000 EUR CR
01-2-2003 456 1500 EUR CR
01-2-2003 123 1450 USD CR
01-4-2003 456 1250 EUR CR
01-7-2003 123 800 USD CR
15-1-2003 123 950 EUR CR
20-1-2003 789 5000 USD CR
27-1-2003 456 5000 USD CR
28-1-2003 456 3000 USD CR
29-1-2003 789 1500 USD CR
30-1-2003 123 1000 EUR DR
The expected result per value date 15-1-2003
Account Balance Currency DR/CR
123 2950 EUR CR
123 2250 USD CR
456 2750 EUR CR
The expected result per value date 31-1-2003
Account Balance Currency DR/CR
123 1950 EUR CR
123 2250 EUR CR
456 8000 USD CR
789 6500 USD CR