Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Understanding joins between multiple tables?

Author  Topic 

Darts75
Starting Member

27 Posts

Posted - 2015-02-04 : 19:39:09
Hi Everyone,

I have a general question concerning joins. Below is a table scenario that I would like advice on -

SELECT *
FROM TABLE_A T0
INNER JOIN TABLE_B T1 ON T1.[Some_Column] = T0.[Some Column]
LEFT JOIN TABLE_C T2 ON T2.[Some_Column] = T0.[Some Column]

Does the above indicate that all records in common between TABLE_A & TABLE_B will be returned, then the records from TABLE_C will be joined to the initial 'result set' (that is the result of joining TABLE_A & TABLE_B), or will TABLE_C simply be joined to TABLE_A regardless of the inner join between TABLE_A & TABLE_B?

Any help with explaining the processing that goes on in this scenario, and the result set that one would expect to receive will be greatly appreciated.

Kind Regards,

David

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2015-02-04 : 19:47:11
It's the first case where the A/B result set is used for the join to C. You get the matches from A, B and C plus the matches from A, B.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -