title: Update multiple rows in table with values from a temporary table
body: <p>I'm trying to write a database migration script to add a column to a table that contains existing data, and then populate that column with appropriate data.</p>
  
  <p>I'm doing the migration in a few steps. I've created a temporary table that contains a single column with ids like this:</p>
  
  <pre><code>new_column
  ==========
  1000
  1001
  1002
  1003
  ...  
  </code></pre>
  
  <p>I now want to update my existing table so that each row in the temporary table above is used to update each row in my existing table. The existing table looks like this:</p>
  
  <pre><code>old_column_1 | old_column_2 | new_column
  ========================================
  1            | 100          | null
  2            | 101          | null
  3            | 102          | null
  ...
  </code></pre>
  
  <p>I've tried a few variations of this sort of update -</p>
  
  <pre><code>select min(t.new_column) 
  from temp t 
  where t.new_column not in (select new_column from existing_table);
  </code></pre>
  
  <p>But I can't seem to get the syntax right...</p>