-
You get it via
SELECT LAST_INSERT_ID();
or via having your framework/MySQL library (in whatever language) callmysql_insert_id()
. -
That won’t work. There you have to query the IDs after inserting.
More Related Contents:
- How to do a batch insert in MySQL
- How to insert data to MySQL with auto-incremented column(field)?
- Which DB technology is sued to solve the following search issue? [closed]
- How to select the nth row in a SQL database table?
- MySQL Error: : ‘Access denied for user ‘root’@’localhost’
- What’s faster, SELECT DISTINCT or GROUP BY in MySQL?
- Storing JSON in database vs. having a new column for each key
- How do I restore a dump file from mysqldump?
- Can a table field contain a hyphen?
- Adding a leading zero to some values in column in MySQL
- View’s SELECT contains a subquery in the FROM clause
- Check for x consecutive days – given timestamps in database
- MySQL Insert Into from one Database in another
- Does mysql have the equivalent of Oracle’s “analytic functions”?
- Case statement in MySQL
- Replace Into Query Syntax
- MySQL INSERT INTO … VALUES and SELECT
- Remove special characters from a database field
- Using reserved words in column names
- MySQL query, MAX() + GROUP BY
- What are practical differences between `REPLACE` and `INSERT … ON DUPLICATE KEY UPDATE` in MySQL?
- MySQL – Replace Character in Columns
- FIND_IN_SET with multiple value [duplicate]
- Foreign key constraints: When to use ON UPDATE and ON DELETE
- What is the difference between SQL and MySQL? [closed]
- “Unknown column in ‘field list'”, but column does exist
- MySQL: Computed Column
- Optimistic locking in MySQL
- Insert and set value with max()+1 problems
- mySQL SELECT upcoming birthdays