I have some legacy code I’m going through, and i just found a join with two “on” clauses…
select * from table
inner join table3
inner join table2 on table3.key = table2.fkey on table.key = table2.otherkey
What does this kind of join mean? (It currently works so it’s not a syntax error)
(Edit: Fixed the code, was missing a join)
Post your edit it’s just a case of knowing the implicit precedence.
is the same as
which hopefully makes more sense. All I have done here is add parentheses.
The first join,
table3totable2, conceptually speaking produces an intermediate table with all the columns from both.table1is then joined to this using the secondonclause you see.