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
 Transact-SQL (2000)
 sql help

Author  Topic 

nflor001
Starting Member

2 Posts

Posted - 2003-07-15 : 14:22:41
list all the suppliers who supply at least one item that has not yet been ordered by anyone?? Whats the sql syntax

Thanks



ord_no | id | sname | item | quantity
1 | 1 | a_pro | veg | 2
2 | 1 | c_inc | flr | 1
3 | 2 | a_pro | cau | 10
4 | 2 | b_sup | stk | 2
5 | 2 | a_pro | let | 2
6 | 2 | c_inc | flr | 1




sname | item | price
| |
a_pro | veg | 3.99
a_pro | cau | 1.00
a_pro | let | 0.75
b_sup | stk | 2.99
c_inc | flr | 1.50
c_inc | veg | 4.00

setbasedisthetruepath
Used SQL Salesman

992 Posts

Posted - 2003-07-15 : 14:39:05
In general, you need to supply the actual DDL (the CREATE TABLE statements) for the tables relevant to your question, not some pretty-printed rowlist.

Assuming I have tables called "orders" and "suppliers" ... :

select distinct s.sname
from suppliers s
where not exists (
select 1
from orders
where item = s.item )


Jonathan
{0}
Go to Top of Page
   

- Advertisement -