title: Update multiple columns Table from a select statement
body: <p>I am trying to update a table from a select statement but none of my rows are being  affected. If I run the select statement I get results so I am not sure .
  In the example I narrowed down the where clause.
  Any help will be appreciated.</p>
  
  <p>My Select </p>
  
  <pre><code>select 
      a.Code,
      a.ItemGroup,
      a.Pack,
      a.bar_code,
      WHStockLink,WHUseInfoDefs,
      b.[iBinLocationID],
      c.cBinLocationDescription,
      ucIIWBin1,
      WHPackCode,
      WHBarCode,
      IdWhseStk
  from
      WhseStk b 
      join StkItem a on a.StockLink = WHStockLink
      inner join _btblBINLocation c on c.idBinLocation = b.iBinLocationID 
  where 
      WHWhseID = 3 and 
      IdWhseStk = 1003000221089 
  order by WHStockLink
  </code></pre>
  
  <p>My Update </p>
  
  <pre><code>update WhseStk
      set ucIIWBin1 = t1.cBinLocationDescription
      from (
          select
              a.Code,
              a.ItemGroup,
              a.Pack,
              a.bar_code,
              WHStockLink,
              WHUseInfoDefs,
              b.[iBinLocationID],
              c.cBinLocationDescription,
              ucIIWBin1,
              WHPackCode,
              WHBarCode,
              IdWhseStk
          from  
              WhseStk b 
              join StkItem a on a.StockLink = WHStockLink
              join _btblBINLocation c on c.idBinLocation = b.iBinLocationID 
          --where WHWhseID = 5 and c.idBinLocation = b.iBinLocationID
           ) t1
      where WHWhseID = 5
  </code></pre>
  
  <p>If I tweak it every row gets affected with the same value .</p>
  
  <p>What I am trying to to is actually to match using the stock link and Whse and populate 3 new user defined fields in the same table ie <code>ucIIWBin1, ucIIWBin2, ucIIWBin13</code>, which are the Bin Description (joined from another table) the barcode and pack from this table.</p>
  
  <p>Whse:</p>
  
  <p><img src="https://i.stack.imgur.com/FsXyT.png" alt=""></p>
  
  <p>Bin:</p>
  
  <p><img src="https://i.stack.imgur.com/uMtTQ.png" alt=""></p>
  
  <p>Stock:</p>
  
  <p><img src="https://i.stack.imgur.com/0k1zq.png" alt=""></p>