Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SELECT
Użytkownik "johnn" <john62_at_electronmail.com> napisał w wiadomości
news:3DB09AD5.5FB6370_at_electronmail.com...
> Okay. Let's say I have a list of usernames in the table users. Let's
> say I have a list of bad users in the table blacklist. Now, let's say I
> want to select all the usernames from the table users that are not in
> the table blacklist? How do I do this? I was thinking of stuff like
> the following:
>
> select * from users where username not in (select * from blacklist);
>
> but it doesn't work.
>
How about:
select u.*
from users u
where not exists (select 1
from blacklist b where u.username = b.username)
gilbeert Received on Tue Oct 22 2002 - 10:45:23 CDT