Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Help with a SQL statement please...
harry wrote:
> I have 2 tables, CUSTOMER & CONTACT - CUSTOMER has a primary key field
> called ID, CONTACT has a foreign key to it called CUST_ID
>
> I want to select all rows from CUSTOMER that don't have any CONTACT rows -
> i.e. customers with no contacts!
>
select * from customer
where id not in (select cust_id from contact)
cheers Received on Fri Jul 14 2006 - 10:05:28 CDT