Declaration
LAST_INSERT_ID()
Description
Returns the value of the auto-increment field from the last insert by the current session.
Specifically, if the most recent INSERT statement inserted multiple records, LAST_INSERT_ID() returns the auto-increment value of the first record.
Examples
obclient> CREATE TABLE t1(c1 INT,c2 INT AUTO_INCREMENT);
obclient> SELECT LAST_INSERT_ID();
+------------------+
| LAST_INSERT_ID() |
+------------------+
| 0 |
+------------------+
1 row in set