I have two tables that share the same columns - BankID, ISIN, Desc.
Table1 is raw data that I get from and outside sources and table2 (a smaller one in terms of rows) manages duplicate values that might appear in the table1.
I want to find only BANKID that appears in Table1 and doesn't appear in Table2 but has another BankID with the same ISIN on table2.
I tried the following query, but it gives me everything that is not on table2, not just the one that has the same ISIN.
Code:
SELECT distinct tb1_isin, tb1_BankID
FROM table1
WHERE not EXISTS (
SELECT top 1 null
FROM table2
WHERE table1.tb1_ISIN = table2.tb2_isin
)
What am I doing wrong?
Thanks,