Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 SQL Query Help

Author  Topic 

pavelushakov
Starting Member

3 Posts

Posted - 2008-01-21 : 19:57:42
Hello,

I've tried searching but couldn't find an answer.

Basically I'm trying to create a query for customers that have not ordered from the store.

There are two database tables; Customers and Orders.

If you can provide any guidance I would be forever grateful.

Thank you
Pavel

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-01-21 : 20:01:59
What are table schemata?
Go to Top of Page

pavelushakov
Starting Member

3 Posts

Posted - 2008-01-21 : 20:08:35
customers
-----------
customerid
name
email



orders
-----------
orderid
customerid
tax
delivery
total
paymentype
Go to Top of Page

singularity
Posting Yak Master

153 Posts

Posted - 2008-01-21 : 21:35:46
Try this:

select * from customers a
left join orders b on a.customerid = b.customerid
where b.customerid is null
Go to Top of Page

pavelushakov
Starting Member

3 Posts

Posted - 2008-01-21 : 22:02:18
Thank you very much sir, that worked perfectly.

Go to Top of Page
   

- Advertisement -