|
Question : Select rows in one table that are not in another table.
|
|
HI. I have a fairly simple problem that i cant work out. I have not slept in 2 days so i think my brain has stopped functining.
I have 2 tables table 1, table 2 each table contains an Account_No column table 1 has 7000 rows, table2 has 6000 rows
I would like ot display the 1000 account numbers that are not in Table2
My sql statment looks something like this..but is far from corrct..
select table1.acct_num from table1 where(select table2.acct_num from table2 where table1.acct_num <> table2.acct_num)
|
|
Answer : Select rows in one table that are not in another table.
|
|
SELECT table1.[acct_num] FROM table1 LEFT JOIN table2 ON table1.[acct_num] = table2.[acct_num] WHERE (((table2.[acct_num]) Is Null));
|
|
|