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
 General SQL Server Forums
 New to SQL Server Programming
 A noobish question

Author  Topic 

Manticure
Starting Member

5 Posts

Posted - 2008-09-24 : 21:29:35
Hello, I just started learning SQL and I got stuck on a question.
Assume we have 2 tables: Customer (with queries CustNo, CustFirstName, CustLastName, CustStreet, CustCity, CustState, CustZip, CustBal) and Product (ProdNo, ProdName, ProdMfg, ProdQOH, ProdPrice) I need to select all products (name, manufacturer and price) ever ordered by 'WA' customers. Thanks in a advance.

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-09-24 : 21:47:36
Does tables have any relationship?
Go to Top of Page

Manticure
Starting Member

5 Posts

Posted - 2008-09-24 : 21:50:05
quote:
Originally posted by sodeep

Does tables have any relationship?


I am not sure what you mean. They are in the same database
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-09-24 : 22:03:05
quote:
Originally posted by Manticure

Hello, I just started learning SQL and I got stuck on a question.
Assume we have 2 tables: Customer (with queries CustNo, CustFirstName, CustLastName, CustStreet, CustCity, CustState, CustZip, CustBal) and Product (ProdNo, ProdName, ProdMfg, ProdQOH, ProdPrice) I need to select all products (name, manufacturer and price) ever ordered by 'WA' customers. Thanks in a advance.



You should be looking at the Orders table not the Customer or Product table.


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

wormz666
Posting Yak Master

110 Posts

Posted - 2008-09-24 : 23:13:59
How will i know which product is being purchase by the customers..
assume you have another table orders which have a field of ordNo,CustNo,ProdNo)

Select * from Product inner join(orders inner join Customer on orders.CustNo = Customer.CustNo) on Product.ProdNo=orders.ProdNo
Go to Top of Page
   

- Advertisement -