On my db server, I insert data into a table with an auto-increment field, such as "id". Now I want to use the value of this last inserted "id" in the next steps. I can use this: -
select * from table_name order by id desc limit 1;
But the problem is that this is a server, and many other insertions can occur, and there may be a case when I try to get data with the request I specified and get a different identifier, i.e. there may be some other insertion between my insert and the choice, and I will not get the value that I inserted. Any way that this could be resolved.
Thanks in advance.
clint
source share