title: Order of operation Inner Join and Where clause performance in SQL Server?
body: <p>Is there any Performance problem to use operation in miss order?</p>
  
  <p>Like
  1. All Inner join first then all where condition later.</p>
  
  <pre><code>    select * from
      t1
      inner join t2 on t1.t2Id = t2.Id
      inner join t3 on t1.t3Id = t3.Id
      inner join t4 on t2.t4Id = t4.Id
      where 
      t1.Id in (1,2,3,4,5)
      and t2.Id in (1,2,3,4,5,6,7)
      and t3.Name like '%a' 
  </code></pre>
  
  <p>2. All table with Respective Where and then Inner join</p>
  
  <pre><code> select * from
      (select * from t1 where t1.Id in (1,2,3,4,5)) a
      inner join (select * from t2 where t2.Id in (1,2,3,4,5,6,7)) a1 on a.t2Id = 
      a.Id
      inner join (select * from t3 where t3.Name like '%a') a2 on a.t3Id = a2.Id
      inner join t4 on a1.t4Id = t4.Id
  </code></pre>
  
  <p>It may effect on query Performance?  </p>
  
  <ol start="3">
  <li><p>Also Order of Where Condition?</p>
  
  <p>Like</p>
  
  <pre><code>select * from t1
  inner join t2 on t1.t2Id = t2.Id
  where t1.t2Id in (1,2,3,4,5,6)
  and t2.t3Id in (1,2,3,4,5)
  </code></pre></li>
  </ol>