Subject | Re: [firebird-support] SQL Question - "Not In" Query |
---|---|
Author | Alexandre Benson Smith |
Post date | 2004-09-16T02:33:02Z |
ra8009 wrote:
customers that have more than one order posted.
try this one:
select
*
from
Customers C
where
not exists (select 1 from Orders O where O.Cust_ID = C.Cust_ID)
see you !
--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda.
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br
>If I have customers and orders, how do I find the customers with noYour statement will work, but you will get a lot of records for
>orders? Is the methos that I'm using below accurate and the best way?
>
>SELECT *
>FROM CUSTOMERS C LEFT OUTER JOIN ORDERS O ON
>C.CUST_ID = O.CUST_ID
>WHERE O.CUST_ID IS NULL
>
>
customers that have more than one order posted.
try this one:
select
*
from
Customers C
where
not exists (select 1 from Orders O where O.Cust_ID = C.Cust_ID)
see you !
--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda.
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br