Select item from one table not in another

  • Thread starter Thread starter mommio2
  • Start date Start date
M

mommio2

Hello, I am desperate to find out how to do this either with SQL or in
design view in Access 2003. Any help you could give me would be REALLY
appreciated!

I have 2 tables, Customer & Order.

Customer has a CustId
Order has an OrderId and a CustId

If a customer has placed an order at any time, he/she will be listed in the
CustID field in the order table, thus he may be in there multiple times.

I need to find the SQL (or a way in design view in Access 2003) to list all
customers who are NOT in the Order table.

THANKS!!!
Mommio2
 
The easiest way to do this would be to use the NOT EXISTS () statement;
something like:

Select C.*
From Customer as C
Where Not Exists (Select * From Order as O where O.CustId = C.CustId)

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Email: sylvain2009 sylvainlafontaine com (fill the blanks, no spam please)
Independent consultant and remote programming for Access and SQL-Server
(French)
 
Back
Top