title: Replacing field value with clone value of the same table
body: <p>I have a table with the following fields.</p>
  
  <pre><code>Account,DeviceID,timestamp,odometer
  </code></pre>
  
  <p>The first three fields are Primary Key
  Some deviceID are cloned in different account.
  Now those clones have corrupted odometer.</p>
  
  <pre><code>Account,DeviceID,timestamp,odometer
   1        A         001      145
   1        A         002      147
   1        A         003      148
   2        A         001      145
   2        A         002      NULL
   2        A         003      0
  </code></pre>
  
  <p>Device A in account 2 is the clon of device A in account 1.</p>
  
  <p>So, how I can clone the odometer values from account 1 and device A to the same timestamp of device A in account 2?</p>
  
  <p>I need to create a store procedure that I can feed whit three paramaters, OriginalAccount, CloneAccount, DeviceID, to fix one by one all the clones.</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>If I have the following data</p>
  
  <pre><code>+---------+-----------+-----------+----------+
  | account | device_id | timestamp | odometer |
  +---------+-----------+-----------+----------+
  |       1 | A         |       001 |      145 |
  |       1 | A         |       002 |      147 |
  |       1 | A         |       003 |      148 |
  |       2 | A         |       001 |      145 |
  |       2 | A         |       002 |     NULL |
  |       2 | A         |       003 |        0 |
  </code></pre>
  
  <p>After call the store procedure the table must look like this</p>
  
  <pre><code>+---------+-----------+-----------+----------+
  | account | device_id | timestamp | odometer |
  +---------+-----------+-----------+----------+
  |       1 | A         |       001 |      145 |
  |       1 | A         |       002 |      147 |
  |       1 | A         |       003 |      148 |
  |       2 | A         |       001 |      145 |
  |       2 | A         |       002 |      147 |
  |       2 | A         |       003 |      148 |
  </code></pre>