title: How to auto-increment ID in Batch insert
body: <p>I have the following query that I want to execute</p>
  
  <pre><code>INSERT INTO TableB (ID, Age, RollNo)
  SELECT (select (max(id) + 1) from TableB), Age, RollNo
  FROM TableA
  WHERE Age &gt; 20 AND RollNo &lt; 500
  </code></pre>
  
  <p>Now all the new entries have the same ID in the TableB</p>
  
  <p>Am i doing something wrong. </p>
  
  <p>P.S. I cannot change the column properties, I cannot set it to AUTO-INCREMENT, it needs to have default value NULL</p>