Say I have three tables in SQL server 2008 R2
SELECT a.*, b.*, c.*
FROM
Table_A a
RIGHT JOIN Table_B b ON a.id = b.id
LEFT JOIN Table_C c ON b.id = c.id
or
SELECT a.*, b.*, c.*
FROM
Table_A a
RIGHT JOIN Table_B b ON a.id = b.id
JOIN Table_C c ON b.id = c.id
also, does it matter if I use b.id or a.id on joining c?
i.e. instead of JOIN Table_C c ON b.id = c.id
, use JOIN Table_C c ON a.id = c.id
Thank you!
Table_B
is missing in your question. It makes more sense if that is added because then the answer is "Yes you need to outer joinTable_C
" otherwise the answer is "It depends on what you want the result to be".