Skip to content Skip to sidebar Skip to footer

How Can I Join A With B And Also B With C At One Time?

I have three A, B, C tables. How can I join A with B and also B with C at one time? For example If I have these tables: Order, Product, User, I want be like this query: SELECT Prod

Solution 1:

Try:

SELECT Product.title, User.username, Order.id
FROMOrder
INNER join Product ONOrder.ProductID = Product.ID
INNER JOIN user ON Product.UserID = User.ID

Solution 2:

Combine joins in the from clause:

select * 
  from aaa a inner join bbb b
     on a.x = b.y
  inner join ccc c
     on b.x = c.y

Solution 3:

select * from A a join B a on a.id = b.id /* condition for join*/join C c on A.id = c.id /* condition for join*/where ;//condition

Post a Comment for "How Can I Join A With B And Also B With C At One Time?"