0

I have SQL Server database with 5 tables, A, B, C, D, E

Is there any difference in between these 2 left outer joins?

A 
(Left Join) B on A.id = B.id 
(Left join) c on B.id = C.id 
(Left join) D on D.id = C.id 
(Left Join) E on D.id = E.id

and

Select * from
(
   A 
   (Left Join) B 
   (Left Join) C
) x,
(
   D (Left Join) E
) y on x.<Something> = y.<something>
user262503
  • 85
  • 2
  • 13
  • 1
    Execute the queries you have and examine the execution plans. If they are the same then no difference if not there is a difference. – Mikael Eriksson Aug 17 '14 at 17:06
  • possible duplicate of [Are left outer joins associative?](http://stackoverflow.com/questions/20022196/are-left-outer-joins-associative) – Pieter Geerkens Aug 17 '14 at 17:08
  • In general the LFET OUTER JOIN operator is not associative, but it is when certain conditions are met as described in the link above. I believe the associativity conditions are satisfied for the specific example you give, but you should compare execution plans to be sure. – Pieter Geerkens Aug 17 '14 at 17:09
  • Mikael and Pieter - the cited dup does not include a discussion of the execution plans (even though both of you brought it up). Should a discussion be added to the cited dup since it appears to be relevant? Or should this question not be marked as a dup? – jww Aug 17 '14 at 20:39

0 Answers0