Last active
February 18, 2016 14:31
-
-
Save ststeiger/465ec70c2f839fa99766 to your computer and use it in GitHub Desktop.
Bracketing in SQL ON-Statements
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT * | |
| FROM T_Site AS St1 | |
| LEFT JOIN T_Site AS St2 | |
| LEFT JOIN T_Building | |
| ON BD_ST_UID = St2.ST_UID | |
| ON St2.SO_UID = St1.ST_UID | |
| -- Is the same as | |
| SELECT * | |
| FROM T_Site AS St1 | |
| LEFT JOIN | |
| ( | |
| SELECT * FROM T_Site AS St2 | |
| LEFT JOIN T_Building | |
| ON BD_ST_UID = St2.ST_UID | |
| ) AS foo | |
| ON foo.ST_UID = St1.ST_UID | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment