title: Select value of one field into another on the same MySQL table in from the same row?
body: <p>If I were to translate my MySQL table into PHP it might look something like this:</p>
  
  <pre><code>$table = array();
  $table[0] = array ('id'=&gt;0, 'f1'=&gt;0, 'f2'=&gt;1);
  $table[1] = array ('id'=&gt;1, 'f1'=&gt;0, 'f2'=&gt;2);
  // etc...
  </code></pre>
  
  <p>In that case, I would want to do something like this:</p>
  
  <pre><code>foreach($table as $row) {
      $row['f1'] = $row['f2'];
  }
  </code></pre>
  
  <p>Is it possible to do this with a single MySQL statement utilizing select and update?</p>
  
  <p>I was imagining something like this:</p>
  
  <pre><code>update myTable set f1=(select f2 from myTable where id=id);
  </code></pre>
  
  <p>Except I don't think that would work...  I'm not sure how to say where id in the second statement is equal to the id in the first statement.  Or how to apply it to all rows in the table.</p>
  
  <p>How could I do this?</p>