title: How to increment a field in MySql using "ON DUPLICATE KEY UPDATE" when inserting multiple rows?
body: <p>How to increment a field in MySql using "ON DUPLICATE KEY UPDATE" when inserting multiple rows?</p>
  
  <p>For one row:</p>
  
  <pre><code>INSERT INTO table 
    (a, counter_elem) 
  VALUES 
    (1, 1)
  ON DUPLICATE KEY UPDATE counter_elem = counter_elem+1;
  </code></pre>
  
  <p>For multiple rows:</p>
  
  <pre><code>INSERT INTO table 
    (a, counter_elem) 
  VALUES 
    (1, 1),
    (2, 1)
  ON DUPLICATE KEY UPDATE counter_elem = ?;
  </code></pre>
  
  <p>This doesn't work:</p>
  
  <pre><code>counter_elem = VALUES(counter_elem)+1
  </code></pre>