Hi,
I have two queries.
Query1: shows all Debits for Companies by Date.
Query2: shows all Credits for Companies by Date.
I have created another query to show all the data for Debits [Query1] - with the following requirements:
If a Query1 Debit amount for a Company for a Date - has a matching Query2 Credit amount for the same Company for the same Date . . .
I don't want that Debit to show in the query.
This is what I did:
In Query Design, I pulled in both queries.
I joined them on CompanyName, EntryDate & TransactionAmount.
Dropped in all the fields from Query1 [Debits].
Went to SQL View.
And changed this:
Code:
SELECT Query1.[CompanyName], Query1.[EntryDate], Query1.[RoutingNumber], Query1.[TranCode], Query1.[TraceNum], Query1.[TransactionAmount]
FROM Query1
INNER JOIN Query2
ON (Query1.TranAmt = Query2.Total)
AND (Query1.[EntryDate] = Query2.[EntryDate])
AND (Query1.[CompanyName] = Query2.[CompanyName]);
to this:
Code:
SELECT Query1.[CompanyName], Query1.[EntryDate], Query1.[RoutingNumber], Query1.[TranCode], Query1.[TraceNum], Query1.[TransactionAmount]
FROM Query1
INNER JOIN Query2
ON (Query1.TranAmt <> Query2.Total)
AND (Query1.[EntryDate] = Query2.[EntryDate])
AND (Query1.[CompanyName] = Query2.[CompanyName]);
It 'APPEARS' to be giving me what I need - on a small sample of the data that I eyeballed.
Am I am doing something intrinsically wrong by putting that "<>" into an 'INNER JOIN' clause.
It's striking me as a bit of an oxymoron to have a '<>' in an Inner Join clause.
?
Is there a better/more correct way to do it?
I'd appreciate any help.
Thanks!!
Robeen