title: pure MySQL loop to update multiple rows
body: <p>I want to update multiple rows based on a SELECT sql query. </p>
  
  <p>I want to do it ALL IN AN SQL SHELL!</p>
  
  <p>Here is my select:</p>
  
  <pre><code>SELECT @myid := id, @mytitle := title
  FROM event 
  WHERE pid&gt;0 GROUP BY title
  ORDER BY start;
  </code></pre>
  
  <p>Then, I want to do an update with this pseudocode:</p>
  
  <pre><code>foreach($mytitle as $t)
  BEGIN
      UPDATE event
      SET pid=$myid
      WHERE title=$t;
  END
  </code></pre>
  
  <p>But I don't know how to ake a loop in SQL.</p>
  
  <p>Maybe there's a way to make it in a single sql query?</p>
  
  <p>I DON'T WANT ANY PHP!!! ONLY SQL SHELL CODE!!!</p>