title: How to update multiple Columns in T-SQL from Multikey tables
body: <p>I'm facing a problem updating a Table from another table values.</p>
  
  <p>Suppose I have:</p>
  
  <p>TableA (keyA, keyB, fieldA, fieldB)</p>
  
  <p>TableB (keyA, keyB, fieldA, fieldB, fieldC)</p>
  
  <p>And I want to update the rows in the TableA that compares in the Table B with the TableB values.</p>
  
  <p>I tried this way:</p>
  
  <pre><code>UPDATE TableA
  SET FieldA = 
  (
  SELECT FieldA
  FROM TableA W INNER JOIN TableB as V
      ON  W.keyA = V.keyA AND
          W.keyB = V.keyB
  WHERE W.KeyA = V.KeyA AND
          W.keyB = V.KeyB AND 
  ) 
  FROM TableA PK INNER JOIN TableB  AS I ON
  TableA.keyA = TableB.keyA AND TableA.keyB = TableB.keyB
  </code></pre>