Comments - LAST_INSERT_ID

2 months, 1 week ago Kevin O'Halloran

if you have multiple tables in a database using AUTO_INCREMENT, how do you identify which table is referred to when you query

SELECT LAST_INSERT_ID();

Presumably it is the last AUTO_INCREMENT value updated regardless of table? I suppose if it is limited by session, then you can have some idea -- but this seems a little tenuous. Is there a way to use this function to explicitly retrieve the last insert id for a specific table?

 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.