Last inserted ID in MySQL

To retrieve the last inserted ID of the auto_increment column:

mysql> select last_insert_id();

The PHP equivalent is:

mysql_insert_id

The above must be invoked from the same thread that performed the insertion.

One Response to “Last inserted ID in MySQL”

  1. Manjula Says:

    I wont to know how to take last inserted id(auto increment) wont to take insert time as output.

    Thanks
    Manjula

Leave a Reply