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
 Join tables questions

Author  Topic 

siumui
Yak Posting Veteran

54 Posts

Posted - 2012-03-13 : 13:24:04
Hello all.

I have questions with joining multiple tables if anyone can help.

select *
from employee a
Left Join department b
On a.id = b.id
Left Join salary c
On a.id = c.id

My question is about the order of the join ......table a will be joined with table b first. Then the result of the joined from table a and b will then be join with table c, correct?

Please help.
Thanks.

siumui

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2012-03-13 : 13:30:11
http://blogs.msdn.com/b/conor_cunningham_msft/archive/2009/12/10/conor-vs-does-join-order-matter.aspx

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

siumui
Yak Posting Veteran

54 Posts

Posted - 2012-03-13 : 14:28:17
Thank you tkizer.

I'm still not clear after reading from the link you provided. Do you know of any other resources that I can look at?

Thanks.

siumui
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2012-03-13 : 14:38:24
Lots of articles out there on this subject: https://www.google.com/webhp?sourceid=chrome-instant&ix=sea&ie=UTF-8&ion=1#hl=en&output=search&sclient=psy-ab&q=sql%20server%20does%20ordering%20of%20joins%20matter&oq=&aq=&aqi=&aql=&gs_sm=&gs_upl=&gs_l=&pbx=1&fp=e50b7ed8b228eb18&ix=sea&ion=1&bav=on.2,or.r_gc.r_pw.r_cp.r_qf.,cf.osb&biw=1554&bih=877

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -