title: Update all rows for one column in a table with data in another table
body: <p>I appreciate any advice on this..</p>
  
  <p>I have two tables where I have to update a column in my primary table with data that resides in another secondary table.  I cannot rely on views, etc as this data has to be able to be edited by the user in APEX in the future.  I am basically pre-populating the data for the users to reduce their manual entry.</p>
  
  <p>Primary Table = <code>Table 1</code></p>
  
  <p>Secondary Table = <code>Table 2</code></p>
  
  <p>Columns to be updated in <code>Table 1</code>  = <code>FTE_ID</code>, <code>ACCOUNT_TYPE</code></p>
  
  <p>Columns where the data will come from <code>Table 2</code> = <code>R_ID</code>, <code>ACCOUNT_TYPE</code></p>
  
  <p>Common column in both tables = <code>TABLE1.FID</code> AND <code>TABLE2.FID</code></p>
  
  <p>Here is what I have tried, but I get "single-row subquery returns more than one row" because there are multiple <code>table1.fid</code> rows in <code>table1</code>.  I basically want to perform this update for ALL rows where <code>TABLE1.FID = TABLE2.FID</code>.</p>
  
  <p>Here is my attempt:</p>
  
  <pre><code>UPDATE TABLE1
  SET TABLE1.FTE_ID = 
  (SELECT TABLE2.R_ID FROM TABLE2 WHERE TABLE1.FID = TABLE2.FID);
  </code></pre>
  
  <p>Error:</p>
  
  <blockquote>
    <p>single-row subquery returns more than one row</p>
  </blockquote>
  
  <p>Thanks for your help,</p>