please help

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
if I want to find a user_id from table 1 which does not exist in the
table 2(possible multiple entries for any user_id). the user_id in
table 2 is a subset from table 1.
if I can not use subquery and minus, how can I do it?

Re: please help wrote:
Quoted text here. Click to load it

Use an outer join.  Where there is no match, there you have a user_id
that does not exist in table2.

SELECT t1.user_id
FROM table1 AS t1
  LEFT OUTER JOIN table2 AS t2 ON t1.user_id = t2.user_id
WHERE t2.user_id IS NULL;

Bill K.

Re: please help

thanks. Bill.
really helpful
Bill Karwin wrote:
Quoted text here. Click to load it

Site Timeline