Skip to content

Instantly share code, notes, and snippets.

@shaneis
Created December 7, 2017 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shaneis/486f1209f59830efd6051fd6d4fa9b9a to your computer and use it in GitHub Desktop.
Save shaneis/486f1209f59830efd6051fd6d4fa9b9a to your computer and use it in GitHub Desktop.
-- right join
SELECT t4.Col1 AS Table4,
t2.Col1 AS Table2,
t3.Col1 AS Table3
FROM dbo.table1 AS t1
JOIN dbo.table2 AS t2 ON t2.Col1 = t1.Col1
JOIN dbo.table3 AS t3 ON t3.Col1 = t2.Col1
RIGHT JOIN dbo.table1 AS t4 ON t4.Col1 = t1.Col1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment