My question is based on the answer from asemprini87 from this link:How to Join 4 tables in SQL. (please check the original tables through this link, if you are interested).
My question focuses on: how to understand the last join, and why the syntax is right: the two tables(p, pe) at the last join on condition, not related to based table (f)?
Because I also face the same problem: there are 4 tables, but no one table related to the other three, I found the answer from that link, the answer is correct, but I don't understand why it can link like that.
SELECT
f.nomeFornecedor,
e.idEncomenda,
p.nomeProduto,
pe.quantidade
FROM
Fornecedor as f
INNER JOIN
Encomenda AS e ON f.idFornecedor = e.idFornededor
INNER JOIN
Produto_Encomenda as pe ON e.idEncomenda = pe.idEncomenda
INNER JOIN
Produto as p ON p.idProduto = pe.idProduto
Thank you.