title: how do I update table1 values (select from table2) where table1.email = table2.email
body: <p>I have trying to copy some data from one table to another where the email addresses are the same.</p>
  
  <p>For example:</p>
  
  <p>Table 1 has fields:<br>
  <code>email, title, first_name, last_name, (+ others)</code></p>
  
  <p>Table 2 has fields:<br>
  <code>email, title, first_name, last_name, modified, (+ others)</code></p>
  
  <p>I want to copy the <code>title</code>, <code>first_name</code>, <code>last_name</code> from <code>table2</code> to <code>table1</code> where <code>table1.email = table2.email</code>.</p>
  
  <p>So <code>table2</code> holds all the data, which I would like to copy into <code>table1</code> where the email in <code>table1</code> matches the <code>FIRST 'most recent (by 'modified')' email found</code> in <code>table2</code> (so the most recent modified <code>datetime</code>).</p>
  
  <p>I was trying something like this:</p>
  
  <pre><code>INSERT INTO `table1` (title, first_name, last_name)
      SELECT title, first_name, last_name from `table2`
      WHERE table1.email = table2.email
  
  ERROR: Unknown column 'table1.email' in 'where clause'
  </code></pre>
  
  <p>So basically, I need something like this in one statement.. </p>
  
  <pre><code>SELECT EMAIL as `originalEmail` FROM `table1` 
      SELECT title, first_name, last_name FROM `table2` 
      WHERE table2.email = table1.email
      ORDER BY `modified` desc # Get the most recently modified
      LIMIT 1                  # limit to 1 result (the most recent one)
  UPDATE `table1` (title, first_name, last_name) values (*values from above*)
  WHERE EMAIL = `originalEmail`
  </code></pre>
  
  <hr>
  
  <p>Edit
   - I would like to <code>UPDATE</code> and not <code>INSERT</code> a new record.</p>