Friday, June 22, 2018

sql programming multiple table join

SQL is a most popular language . It's useful for fetching ,storing, manipulate from database.There are most common things in SQL is joining . In  software field joining table is necessary.Previous tutorial we learn about  different type of joining Technic . In this tutorial section i discuss about multiple training joining. Lot's of my follower request for multiple joining .   

ORDERITEM
Id
OrderId
ProductId

PRODUCT
Id
ProductName
SupplierId

PRODUCT PRICE
id
productid
price

ORDER
Id
OrderDate
Order Number

This query join four table data.

SQL Query :

SELECT O.OrderNumber, P.ProductName, I.OrderId , X.price
FROM Order O
JOIN OrderItem I ON O.Id = I.OrderId
JOIN Product P ON P.Id = I.ProductId
JOIN   ProductPrice X ON P.Id = X.ProductId

No comments:

Post a Comment