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)
 need help in sql-query

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-06-06 : 09:17:50
Rakesh Kumar writes "Dear ,

i have three table like cutstomer_master(cust_id,Cust_name),Item_master(item_id ,Item_name) and transaction table Cust_item(cust_id,Item_id) i need to display the name of cutomer who purchase all the item .

Plz Help Me I am struggling very hard "

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-06-06 : 09:24:45
try this
select c.cust_id, c.cust_name
from customer_master c inner join cust_item i
on c.cust_id = i.cust_id
group by c.cust_id, c.cust_name
having count(*) = (select count(*) from item_master)



KH

Go to Top of Page
   

- Advertisement -