I have two tables to compare, currently without a key field which I can add if necessary for any uniqueness of records one might find necessary to solve this problem. As you can see below I need to return 6 rows
I have one table called BankDebits that has these 9 rows (just a sampling of data with one test amount of 800.00):
Store Amount
36 800.00
36 800.00
126 800.00
175 800.00
175 800.00
252 800.00
704 800.00
1607 800.00
1621 800.00
I have another table called Bank that has these 4 rows (just a sampling of data with one test amount of 800.00):Store Amount
36 800.00
126 800.00
175 800.00
252 800.00
I only want this data returned with these four records that match:
Store Amount
36 800.00
126 800.00
175 800.00
252 800.00
SELECT BankDebits.Store, BankDebits.Amount
FROM Bank LEFT JOIN BankDebits ON Bank.Amount = BankDebits.Amount
GROUP BY BankDebits.Store, BankDebits.Amount
ORDER BY BankDebits.Amount DESC;
- successfully gives me this:
Store Amount
36 800.00
126 800.00
175 800.00
252 800.00
Problem is I need a query that will give me the rest of the unmatched:
Store Amount
36 800.00
175 800.00
704 800.00
1607 800.00
1621 800.00
But the below returns no records... thanks in advance for any help:
SELECT Bank.Store, Bank.Amount
FROM Bank
WHERE (((Exists (SELECT Bank.Store, Bank.Amount
FROM BankDebits LEFT JOIN Bank ON BankDebits.Amount = Bank.Amount))=False))
ORDER BY Bank.Amount DESC;