Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL question
In article <3577487B.53BBB72_at_hotmail.com>, zyber <zybermaniac_at_hotmail.com> writes:
> I have 2 tables:
> FRIEND
> --------------
> NAME STATE
>
> DAVE CA
> MATT TX
> HAL VA
> JAN TX
>
>
> CUSTOMER
> --------------
> NAME OWED
>
> HAL 45.50
> FRANK 12.35
> KEITH 5.15
> JAN 12.10
>
> How do I write SQL statement to list all
> friends who are not my customer?
> (which is Dave and Matt)
>
> I tried this but didn't work:
>
> SELECT F.NAME "NAME", F.STATE "IN"
> FROM FRIEND F, CUSTOMER C
> WHERE F.NAME <> C.NAME;
>
> Thanks in advance,
> Z
>
>
>
--
Try:
select f.name from friend f where
f.name not in
(select c.name from customer c);
-Phill -----------------------------------------------------------------------------"Off the keyboard, through the CPU, out the transceiver, down the rj45 line, across the router, through the Hub, out the gateway. Nothing but net."
Phill Weiss Motorola Software Competency Center Voice: +1 847 632 5701 Metrics & Qualitative Analysis Group FAX: +1 847 632 7521 1501 W. Shure Drive IL27-3G6 email: CEMX13_at_email.mot.com Arlington Heights, IL 60004WWW: http://www.cig.mot.com/~weiss