Wednesday, 23 January 2013

Joining 3 or more Tables in SQL Server


Joining 3 or more Tables in SQL Server


Here is a sample SQL Query which would let you join Three or more Tables and display data from them using simple Select Statement:



SELECT p.Name, v.Name

FROM Production.Product p

JOIN Purchasing.ProductVendor pv

ON p.ProductID = pv.ProductID

JOIN Purchasing.Vendor v

ON pv.BusinessEntityID = v.BusinessEntityID

WHERE ProductSubcategoryID = 15

ORDER BY v.Name;

Modify the field names and Table Names according to your requirement...

No comments:

Post a Comment

Thank You for Your Comments. We will get back to you soon.

back to top