JapanFreak
Registered User.
- Local time
- Today, 03:23
- Joined
- Aug 25, 2007
- Messages
- 45
Dear All,
once again I have a problem where I have absolutely no idea where to start from...
I have two tables. The first one, called tblAccounting, contains cash transactions. It looks like follows:
The following query gives me the account level for any arbitrarily chosen date, e.g. for 09/20/07, for all income accounts (every income account starts with "I_", hence the WHERE part):
I have a second table, tblDividends, which records Dividend Payments. It looks like follows:
What I am looking for is a query, which gives me the total of all income accounts, i.e. the total sum of all income accounts (those with a leading "I_") in tblAccounting plus the GrossDividends received. The latter one would be calculated as the sum of the column GrossDividend of tblDividends until the given date. Is that possible at all?
One alternative I already thought of would be of course to include the dividend income as a further account in tblAccounting, however if possible I would like to avoid that so that I do not need to keep records of the same transaction two times and thereby reduce potential error sources.
As always I would be happy for any hint that could lead to a solution.
Have a nice weekend!
JapanFreak
once again I have a problem where I have absolutely no idea where to start from...
I have two tables. The first one, called tblAccounting, contains cash transactions. It looks like follows:
Code:
AccDate Account Amount Currency Remarks
09/01/07 Account1 50.00 USD uvw
09/05/07 Account2 75.00 USD xyz
The following query gives me the account level for any arbitrarily chosen date, e.g. for 09/20/07, for all income accounts (every income account starts with "I_", hence the WHERE part):
Code:
SELECT A.Account, sum(A.Amount) AS Amount
FROM tblAccounting AS A
WHERE A.Account Like "I_*" And A.Currency="USD" And A.AccDate<=#9/20/2007#
GROUP BY A.Account;
I have a second table, tblDividends, which records Dividend Payments. It looks like follows:
Code:
DivDate SecurityTicker GrossDividend Tax Currency
09/01/07 ABC 5.00 0.50 USD
09/05/07 DEF 4.00 0.30 USD
What I am looking for is a query, which gives me the total of all income accounts, i.e. the total sum of all income accounts (those with a leading "I_") in tblAccounting plus the GrossDividends received. The latter one would be calculated as the sum of the column GrossDividend of tblDividends until the given date. Is that possible at all?
One alternative I already thought of would be of course to include the dividend income as a further account in tblAccounting, however if possible I would like to avoid that so that I do not need to keep records of the same transaction two times and thereby reduce potential error sources.
As always I would be happy for any hint that could lead to a solution.
Have a nice weekend!
JapanFreak