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.
| Author |
Topic |
|
DJJUBES
Starting Member
4 Posts |
Posted - 2012-05-20 : 16:22:28
|
| Hi thereI have the following query:I would like to know the Name of theCompany, the Contact Person linked to the company, the product ID linked to the company’s products, the products that the supplier supplies, the price of each product,and finally the quantity of the products in stock.The results that needs to be displayed are as follows, CompanyName, ContactName, ProductID, ProductName, UnitPrice, Quantity.It seems to me that a triple join of some kind is needed to answer such a query, how does one join three tables? |
|
|
vijays3
Constraint Violating Yak Guru
354 Posts |
Posted - 2012-05-20 : 16:52:39
|
| can you please provide sample data of your requirement ad desired output?Vijay is here to learn something from you guys. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-05-20 : 17:32:23
|
just likeselect columns...from table1 t1inner join table2 t2on t2.relatedfield = t1.relatedfieldinner join table3 t3on t3.relatedfield = t2.relatedfield.. just put the correct table names and correct set of columns by which they're related and you're good to go!------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|