title: sql update table set - The multi-part identifier could not be bound
body: <p>I have 2 tables:</p>
  
  <ul>
  <li><strong>Table1</strong> = names of gas stations (in pairs)</li>
  <li><strong>Table2</strong> = has co-ordinate information (longitude and latitude amongst other things)</li>
  </ul>
  
  <p>Example of <strong>Table1</strong>:</p>
  
  <pre><code>StationID1  StationID2  Name1   Name2   Lattitude1  Longitude1  Lattitude2  Longitude2  Distance
  ------------------------------------------------------------------------------------------------
  93353477    52452   FOO     BAR     NULL        NULL        NULL    NULL    NULL
  93353527    52452   HENRY   BENNY   NULL        NULL        NULL    NULL    NULL
  93353551    52452   GALE    SAM     NULL        NULL        NULL    NULL    NULL
  </code></pre>
  
  <p>Example of <strong>Table2</strong>:</p>
  
  <pre><code>IDInfo     Name  Lattitude    Longitude
  -------------------------------------------
  93353477   BAR   37.929654    -87.029622
  </code></pre>
  
  <p>I want to update this table with the coordinate information which resides in <code>tableA</code>. I tried to do the following as per <a href="https://stackoverflow.com/questions/4933888/sql-server-2005-the-multi-part-identifier-could-not-be-bound">SQL Server 2005: The multi-part identifier … could not be bound</a></p>
  
  <pre><code>update table1
  set t1.[Lattitude1] = t2.[Lattitude]
  from table1 t1
  left join table2 t2 
  on (t1.StationID1 = t2.IDInfo)
  </code></pre>
  
  <p>I get the following error message:</p>
  
  <blockquote>
    <p><em>Msg 4104, Level 16, State 1, Line 1<br>
    The multi-part identifier "t1.Lattitude1" could not be bound.</em></p>
  </blockquote>
  
  <p>However, if I do the following it works which I can then store into another table. </p>
  
  <pre><code>SELECT t1.[StationID1]
        ,t1.[StationID2]
        ,t1.[Name1]
        ,t1.[Name2]
          ,t2.[Lattitude] AS [Lattitude1]
          ,t2.[Longitude] AS [Longitude1]
          ,t3.[Lattitude] AS [Lattitude2]
          ,t3.[Longitude] AS [Longitude2]
  from table1 t1
  left join table2 t2 
  on (t1.StationID1 = t2.IDInfo)
  left join table2 t3 
  on (t1.StationID2 = t2.IDInfo)
  </code></pre>
  
  <p>I am very new to SQL and am having a difficult time understanding why some things work and others don't. Based on the link I posted above my initial query should have worked - no? Perhaps I'm not thinking straight as I have spent many hours trying this and I finally got help from a co-worker (she suggested the approach I mention above).</p>