title: How do I prevent MySQL from auto-incrementing the Primary Key while using ON DUPLICATE KEY UPDATE when the duplicate is a different unique column?
body: <p>Consider the following table:</p>
  
  <pre><code>+-------------+------------------+------+-----+---------+----------------+
  | Field       | Type             | Null | Key | Default | Extra          |
  +-------------+------------------+------+-----+---------+----------------+
  | vendor_id   | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
  | vendor_name | varchar(100)     | NO   | UNI | NULL    |                |
  | count       | int(10) unsigned | NO   |     | 1       |                |
  +-------------+------------------+------+-----+---------+----------------+
  </code></pre>
  
  <p>I have the following MySQL query:</p>
  
  <pre><code>INSERT INTO `table` 
     (`vendor_name`) 
  VALUES 
     ('foobar') ON DUPLICATE KEY UPDATE `count` = `count` + 1
  </code></pre>
  
  <p>The intent of this query is to insert a new vendor name to the table and in case the vendor name already exists, the column count should be incremented by 1. This works however the primary key of the current column will also be auto-incremented. How can I prevent MySQL from auto-incrementing the primary key in these cases? Is there a way to do this with one query?</p>
  
  <p>Thank you.</p>