Hi KKerig,
It sounds like you want to UNION (no "ALL")
the query below with second like query
where tables are reversed on the LEFT JOIN.
Plus you will have issues with filtering
on an outer join.
One method....
Create a query that filters for specific
records from [Oracle Actuals by Month] :
(say it is called "qryActuals")
SELECT
A.Org,
A.Dept,
A.[GL Acct],
A.JunTotal AS Actual
FROM [Oracle Actuals by Month] AS A
WHERE
(((A.Org)=30)
AND
((A.Dept)=130));
Then create second query that filters for
specific records from [Oracle budget by Month]
(say it is called "qryBudget")
SELECT
B.Org,
B.Dept,
B.[GL Acct],
B.[Jun-04] AS Budget
FROM [Oracle budget by Month] As B
WHERE
(((B.ORG)=30)
AND
((B.DEP)=130));
Then use this query in a "frustrated outer join" UNION query.
SELECT
A1.Org,
A1.Dept,
A1.[GL Acct],
A1.Actual
B1.Budget,
FROM
qryActuals AS A1
LEFT JOIN
qryBudget As B1
ON
(A1.Org = B1.ORG)
AND
(A1.Dept = B1.DEP)
AND
(A1.[GL Acct] = B1.ACCT)
UNION
SELECT
A2.Org,
A2.Dept,
A2.[GL Acct],
A2.Actual
B2. Budget,
FROM
qryBudget As B2
LEFT JOIN
qryActuals AS A2
ON
( B2.ORG = A2.Org )
AND
( B2.DEP = A2.Dept )
AND
( B2.ACCT = A2.[GL Acct] );
Of course...I could be wrong...
Good luck,
Gary Walter
KKerig said:
I have the same question as below and I have been trying to use this example in my
data, without success. I have already summed my actuals and budgets and put them
into their own tables. I have been able to get Actuals without Budgets but I still
have Budgets without Actuals that I am not getting.
Here is the query I'm working with. This particular dept and Org have a Budget
without Actuals and Actuals without a Budget in some GL Accts.
SELECT [Oracle Actuals by Month].Org, [Oracle Actuals by Month].Dept, [Oracle
Actuals by Month].[GL Acct], [Oracle budget by Month].[Jun-04] AS Budget, [Oracle
Actuals by Month].JunTotal AS Actual
FROM [Oracle Actuals by Month] LEFT JOIN [Oracle budget by Month] ON ([Oracle
Actuals by Month].Org = [Oracle budget by Month].ORG) AND ([Oracle Actuals by
Month].Dept = [Oracle budget by Month].DEP) AND ([Oracle Actuals by Month].[GL Acct]
= [Oracle budget by Month].ACCT)
WHERE ((([Oracle Actuals by Month].Org)=30) AND (([Oracle Actuals by Month].Dept)=130));
I Appreciate any help you can give.
Cheers,
Rogers
MGFoster said:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
SELECT A.Expense,
Sum(A.Actual) As ActualSum,
Sum(B.Budget) As BudgetSum,
Sum(B.Budget) - Sum(A.Actual) As Variance
FROM Actual As A LEFT JOIN Budget As B
ON A.Expense = B.Expense
WHERE <criteria>
GROUP BY A.Expense
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBQJlDX4echKqOuFEgEQL7DACdGjmOYxMec/cwNBRL+h6bMklH8HQAn1r6
+Fknoh/mffju+XOLaxfeoxiR
=LGkw
-----END PGP SIGNATURE-----