Union All

Geert

Registered User.
Local time
Today, 08:44
Joined
Feb 15, 2005
Messages
10
Hello,
I want to see the numbers for a particular @Year, with totals for each Month, Account and Department.

The following tables:
Budget: (Year, Month, Account, Dept) (PK), Amount

Commitments: CommitmentID (Identity, PK), Year, Month, Account, Dept, Amount

Actuals: ActualID (Identity, PK), Year, Month, Account, Dept, Amount

SQL:
SELECT [Year] [Month] [Account] [Dept] Amount as Budget 1 as Commitment 1 as Actual
FROM Budget
UNION ALL
SELECT [Year] [Month] [Account] ]Dept] Amount as Budget 1 as Commitment 1 as Actual
FROM Commitments
UNION ALL
SELECT [Year] [Month] [Account] ]Dept] Amount as Budget 1 as Commitment 1 as Actual
FROM Actuals
WHERE Year = 2006
GROUP BY [Year] =2006 [Month] = 12 [Account] <> 0 [Dept] =1;

I am not good i SQL. I am learning at the moment Access for beginners.
My SQL does not working. Who can help me to see the numbers for a particular @Year, with totals for each Month, Account and Department.

I hope to get Budgets, Commitments and Actuals all together.
I hope to make a good example of this and i need your help.
I will appreciate this very much.


Regards,

Geert
email geert678@hotmail.com
(From Belgium)
 

Attachments

Users who are viewing this thread

Back
Top Bottom