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)
 Selection without temp table

Author  Topic 

vgr.raju
Yak Posting Veteran

95 Posts

Posted - 2005-07-14 : 23:43:07
select c.companyname,p.productid,p.productname
from products p join [order details] od on od.productid=p.productid
join orders o on od.orderid=o.orderid
join customers c on c.customerid = o.customerid
and p.productname ='chocolade'


select c.companyname,p.productid,p.productname
from products p join [order details] od on od.productid=p.productid
join orders o on od.orderid=o.orderid
join customers c on c.customerid = o.customerid
and p.productname ='vegie-spread'
Rite now I am using two temprory tables and then joining them to get company with both product names.
Is it possible for me to do without temp tables.

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2005-07-14 : 23:47:05
add a where clause?

quote:

select c.companyname,p.productid,p.productname
from products p join [order details] od on od.productid=p.productid
join orders o on od.orderid=o.orderid
join customers c on c.customerid = o.customerid
where p.productname ='chocolade'
or p.productname ='vegie-spread'




--------------------
keeping it simple...
Go to Top of Page
   

- Advertisement -