I have 3 table A,B,C,D with the same columns and I'm trying to retrieve the
user_id that are in table a and b but not c.
For instance:
Table A
user_id closed acct
10102345 Yes
12456786 Yes
Table B
user_id closed acct
10102345 Yes
12456786 Yes
Table C
user_id closed acct
45345696 No
45698788 Yes
12456786 Yes
Here is what the code that I try but it taking so long to execute:
SELECT user_id FROM TableA WHERE user_id NOT IN (SELECT DISTINCT user_id
FROM TableB) OR user_id NOT IN (SELECT DISTINCT ID FROM Table C)
Best Answer
or