Reputation: 197
I want to join two tables and then I want to join this result with another table but it doesn't work
select * from
(
(select SeId,FLName,Company from Sellers) s
inner join
(select SeId,BIId from BuyInvoices) b
on s.SeId=b.SeId
) Y
inner join
(select * from BuyPayments) X
on Y.BIId=X.BIId
thanks
Upvotes: 0
Views: 41
Reputation: 1269763
In most databases, your syntax isn't going to work. Although parentheses are allowed in the FROM
clause, they don't get their own table aliases.
You can simplify the JOIN
. This is a simpler way to write the logic:
select s.SeId, s.FLName, s.Company, bp.*
from Sellers s inner join
BuyInvoices b
on s.SeId = b.SeId inner join
BuyPayments bp
on bp.BIId = b.BIId;
Upvotes: 1