simple query

From: Lyall Barbour <>
Date: Tue, 29 Jul 2008 15:56:18 -0500
Message-Id: <>

This is the only Oracle list i belong too, so, sorry if this is a little off topic.

Need a query that will get all the customers who have not ordered a certain item, ever.

Have a ORDDETAIL table that links with ORDHEADER with an ORD_NBR column. In the ORDDETAIL table, it has a row for each item on the order. The ORDHEADER has the CUST_CD along with the ORD_NBR.

I've tried

SELECT a.cust_cd
FROM ordheader a, orddetail b
WHERE a.ord_nbr = b.ord_nbr
AND b.item_cd not in (<list of items>)

but this will still bring back a record for the query if there's multiple items on an order and the item isn't in the list.

see what i mean?
Can someone show me the light?


Be Yourself @!
Choose From 200+ Email Addresses
Get a Free Account at

-- Received on Tue Jul 29 2008 - 15:56:18 CDT

Original text of this message