title: SQL Issues - The multi-part identifier could not be bound
body: <p>I'm struggling with something that is probably simple. This is through a linked server. I've scanned this forum for clues but I'm still scratching my head. I'm pretty new at this so forgive me for dumb mistakes. Thank you in advance for any clarity you might be able to provide.</p>
  
  <p>Aaron</p>
  
  <p>When I run this query, I have no issues.</p>
  
  <pre><code>select i.guid 
  from [DBS1].[AltDB].dbo.Item AS i
  </code></pre>
  
  <p>When I run the query below, I get the error. I don't understand how the first query works with <code>i.guid</code> and the second does not.</p>
  
  <blockquote>
    <p>Msg 4104, Level 16, State 1, Line 18<br>
    The multi-part identifier "i.guid" could not be bound.</p>
  </blockquote>
  
  <p>Query:</p>
  
  <pre><code>SELECT TOP (100) PERCENT 
      rrc.Name AS CompName, 'Altiris' AS Source, 
      CASE 
          WHEN i.ProductUninstalled = 1 THEN 'Uninstall ' 
          ELSE '' 
      END + 
      CASE 
          WHEN i.Name = i.Name THEN i.Name 
          ELSE '    - ' + i.Name 
      END AS Summary, 
      eti.ExecutedBy, 
      CASE eti.InstanceStatus 
          WHEN 3 THEN 'Failure' 
          WHEN 0 THEN 'Not Started' 
          WHEN 2 THEN 'Success' 
          WHEN 4 THEN 'Cancelled'
          WHEN 1 THEN 'In Progress' 
          ELSE 'Not Reported' 
      END AS Status, 
      eti.StartTime, 
      eti.EndTime, i.Description AS Detail
  FROM
      [DBS1].[AltDB].dbo.Item AS i 
  INNER JOIN        
      [DBS1].[AltDB].dbo.ItemVersions AS iv 
  INNER JOIN        
      [DBS1].[AltDB].dbo.ItemVersionData AS ivd ON iv.VersionGuid = ivd.VersionGuid ON i.guid = iv.ItemGuid 
  INNER JOIN        
      [DBS1].[AltDB].dbo.TaskInstances AS ti ON ivd.VersionGuid = ti.TaskVersionGuid 
  INNER JOIN        
      [DBS1].[AltDB].dbo.Evt_Task_Instances AS eti ON ti.ResourceGuid = eti._ResourceGuid AND ti.TaskInstanceGuid = eti.TaskInstanceGuid 
  INNER JOIN        
      [DBS1].[AltDB].dbo.RM_ResourceComputer AS rrc ON eti._ResourceGuid = rrc.Guid 
  INNER JOIN        
      [DBS1].[AltDB].dbo.TaskInstances AS ti2 ON eti.ParentTaskInstanceGuid = ti2.TaskInstanceGuid 
  INNER JOIN        
      [DBS1].[AltDB].dbo.ItemVersions AS iv2 
  INNER JOIN        
      [DBS1].[AltDB].dbo.Item ON iv2.ItemGuid = i.guid ON TaskInstances_1.TaskVersionGuid = iv2.VersionGuid
  WHERE
      (i.Attributes = 0)
  ORDER BY 
      eti.StartTime DESC, eti.EndTime DESC
  </code></pre>