How to get latest ID number in a table?

后端 未结 7 1884
日久生厌
日久生厌 2021-01-22 00:58

How can I get the latest ID in a table?

7条回答
  •  终归单人心
    2021-01-22 01:31

    IF you've just inserted into a table with auto_increment you can run right after your query.

    SELECT last_insert_id();
    

    Otherwise the max(id) FROM table

提交回复
热议问题