title: MYSQL Update value from same table
body: <p>I have this table</p>
  
  <pre><code>id  child_id  root_id
  ====================
  1     0        0
  2     0        1
  3     0        2
  </code></pre>
  
  <p>I want to update a row and change child_id to the id of a specific row with root_id as its id.</p>
  
  <p>I have tried this mysql statement</p>
  
  <pre><code>UPDATE table SET child_id = id WHERE id = root_id;
  </code></pre>
  
  <p>An Example of the output i want is</p>
  
  <pre><code>id  child_id  root_id
  ====================
  1     2        0
  2     3        1
  3     0        2
  </code></pre>