title: mysql query to update field to max(field) + 1
body: <p>What I want to do is:</p>
  
  <pre><code>UPDATE table SET field = MAX(field) + 1 WHERE id IN (1, 3, 5, 6, 8);
  </code></pre>
  
  <p>The semantics of this statement, in my mind, would be first the database would go off and determine for me what the largest value of <code>field</code> is in all of <code>table</code>. It would then add 1 to that value, and assign the resulting value to the <code>field</code> column of the rows with <code>id</code> 1, 3, 5, 6, and 8. Seems simple enough...</p>
  
  <p>When I try to run that query though, MySQL chokes on it and says:</p>
  
  <pre><code>ERROR 1111 (HY000): Invalid use of group function
  </code></pre>
  
  <p>What's the secret sauce you have to use to get the outcome I desire?</p>
  
  <p>Regards,
  Vic</p>