title: Updating multiple rows with CASE statement in MySQL
body: <p>I can't figure this out, there are many examples here on stack overflow but there are differences in each one, and they are all giving the same problem.</p>
  
  <p>I've got a list of 80 "slides" which have a column named "order". Order is a number, currently ranging from 0 to 79.</p>
  
  <p>If we delete a slide, we need to adjust the slides following that one, which I've already worked out the algorithm for.</p>
  
  <p>Here is the result of the algorithm:</p>
  
  <pre><code>UPDATE cms_slides SET order = 
      CASE order
          WHEN 68 THEN 67
          WHEN 69 THEN 68
      END CASE
  WHERE order BETWEEN 68 AND 69
  </code></pre>
  
  <p>This is current code is based on Soulmerge's solution here: <a href="https://stackoverflow.com/questions/748720/updating-display-order-of-multiple-mysql-rows-in-one-or-very-few-queries">Updating display order of multiple MySQL rows in one or very few queries</a></p>
  
  <p>The column "order" does in fact reside in "cms_slides", and the values 1 through 69 all exist under "order".</p>
  
  <p>THe error message is the typical: <em>ERROR: You have an error in your SQL syntax; check the manual...</em></p>
  
  <p>Does anyone know what is wrong with the code? I have tried many variations but none work, it's probably something simple.</p>