title: Updating multiple columns depending on 1 CASE-condition
body: <p>I have a program that needs to synchronize it's frequently changing values (in temporary memory) with a database. The critical key (not primary!) in that table is the column <strong><em>id</em></strong>. My program changes the <strong><em>id</em></strong> but keeps the old <strong><em>id</em></strong> in memory, too.</p>
  
  <p>Now, I would like to update several specified columns for multiple records/rows in one single statement. Furthermore, it should be reasonably fast for 5 up to 10 of such statements in 1 second with 4 GB RAM and ~ 50 MBit/s connection that is not only used for these sql-calls.</p>
  
  <p><strong>My sql-specifications</strong></p>
  
  <ul>
  <li>Server: 127.0.0.1 via </li>
  <li>TCP/IP</li>
  <li>Software: MySQL</li>
  <li>Software version: 5.5.27 - MySQL Community Server (GPL)</li>
  <li>Protocol version: 10</li>
  <li>Server charset: UTF-8 Unicode (utf8)</li>
  </ul>
  
  <p>I tried to use brackets...</p>
  
  <pre><code>UPDATE someTable
  SET (id, name) = CASE id 
  WHEN 1 THEN (111, "Dr. Frankenstein") 
  WHEN 2 THEN (222, "the Monster") 
  WHEN 3 THEN (333, "Mr. X") 
  ELSE (id, name) END
  WHERE id IN (1, 2, 3)
  </code></pre>
  
  <p>...which simply results in the following error:</p>
  
  <pre><code>#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(id, name) = CASE id WHEN 1 THEN (111, "Dr. Frankenstein") WHEN 2 THEN (222,' at line 2
  </code></pre>
  
  <p>Know I wonder: Is there a way to do it in just one statement with the current syntax? Would it be feasable that way or should I just split it into multiple statement which is ugly in terms of the program that makes the sql-calls.</p>
  
  <p>Answers and suggestions are welcome!</p>