title: The multi-part identifier could not be bound on SQL Server 2008
body: <p>I have 2 tables</p>
  
  <p><code>requests</code> (<code>ID</code>, <code>company_id</code>, <code>amount</code>)</p>
  
  <p><code>companies</code> (<code>ID</code>, <code>name</code>)</p>
  
  <p>with FK constraint (<code>requests.company_id</code> -> <code>companies.id</code>)</p>
  
  <p><code>requests.company</code> can be <code>NULL</code></p>
  
  <p>I need to get all requests and replace <code>company_id</code> with appropriated company <code>name</code> or left it blank if no company was specified.</p>
  
  <p>I have next query:</p>
  
  <pre><code>SELECT R.[ID], C.[name] AS [company], R.[amount], ...
  FROM [requests] AS R, [companies] AS C, ...
  WHERE R.[company_id] = C.[ID]
  </code></pre>
  
  <p>and it's working fine until a NULL into <code>company</code> field.</p>
  
  <p>I tried to do next:</p>
  
  <pre><code>SELECT R.[ID], C.[name] AS [company], ...
  FROM [requests] AS R, ...
  LEFT OUTER JOIN [companies] AS C
  ON R.[company_id] = S.ID
  </code></pre>
  
  <p>But got</p>
  
  <blockquote>
    <p>The multi-part identifier "R.company_id" could not be bound</p>
  </blockquote>
  
  <p>And the same errors on fields in <code>ON</code> clause shifting. What am I doing wrong?</p>