title: Problem with MySql INSERT MAX()+1
body: <p>I have a single table containing many users. In that table I have column called user_id (INT), which I want increment separately for each person. user_id MUST start at 1</p>
  
  <p>I've prepared a simple example:</p>
  
  <pre><code>Showing all names
  +--------------+-----------------------+
  | user_id      | name                  |
  +--------------+-----------------------+
  | 1            | Bob                   |
  | 1            | Marry                 |
  | 2            | Bob                   |
  | 1            | John                  |
  | 3            | Bob                   |
  | 2            | Marry                 |
  +--------------+-----------------------+
  
  
  Showing only where name = Bob
  +--------------+-----------------------+
  | user_id      | name                  |
  +--------------+-----------------------+
  | 1            | Bob                   |
  | 2            | Bob                   |
  | 3            | Bob                   |
  +--------------+-----------------------+
  </code></pre>
  
  <p>The following query will do this, but it will only work if 'Bob' already exists in the table...</p>
  
  <pre><code>INSERT INTO users(user_id, name) SELECT(SELECT MAX(user_id)+1 from users where 
  name='Bob'), 'Bob';
  </code></pre>
  
  <p>If Bob does not exist (first entry) user_id is set to 0 (zero). This is the problem. I need the user_id to start from 1 not 0.</p>