JohnDTampaBay
Programmer
I have inherited some T-SQL code and I keep running into JOINs with delayed ONs. Much of the code was generated by the graphical Query Designer. I found this example in BOL FROM clause -> FROM clause (described):
--John![[rainbow] [rainbow] [rainbow]](/data/assets/smilies/rainbow.gif)
-----------------------------------
Behold! As a wild ass in the desert
go forth I to do my work.
--Gurnie Hallock (Dune)
Can't this be written as< joined_table >
Is a result set that is the product of two or more tables, for example:
SELECT *
FROM tab1 LEFT OUTER JOIN tab2 ON tab1.c3 = tab2.c3
RIGHT OUTER JOIN tab3 LEFT OUTER JOIN tab4
ON tab3.c1 = tab4.c1
ON tab2.c3 = tab4.c3
For multiple CROSS joins, use parentheses to change the natural order of the joins.
What's the purpose of the delayed ON criteria between tab2 and tab4 in the BOL example? What am I missing?SELECT *
FROM tab1
LEFT OUTER JOIN tab2
ON tab1.c3 = tab2.c3
LEFT OUTER JOIN tab4
ON tab2.c3 = tab4.c3
RIGHT OUTER JOIN tab3
ON tab3.c1 = tab4.c1
--John
![[rainbow] [rainbow] [rainbow]](/data/assets/smilies/rainbow.gif)
-----------------------------------
Behold! As a wild ass in the desert
go forth I to do my work.
--Gurnie Hallock (Dune)