How do I get the ID of multiple inserted rows in MySQL?

  1. You get it via SELECT LAST_INSERT_ID(); or via having your framework/MySQL library (in whatever language) call mysql_insert_id().

  2. That won’t work. There you have to query the IDs after inserting.

Leave a Comment