Return the ID generated for the last row inserted into a table with an AUTO_INCREMENT column.
SELECT LAST_INSERT_ID(); |
The LAST_INSERT_ID()
function retrieves the AUTO_INCREMENT ID of the last inserted row in a table.
LAST_INSERT_ID(expression) |
Parameter |
Description |
expression |
Not required; an expression |
Works in: |
From MySQL version 4.0 |