开发者

How to pass table name using the LAST_INSERT_ID keyword in MySQL?

开发者 https://www.devze.com 2023-03-09 17:02 出处:网络
How do 开发者_开发百科you to find last identity insert value in MySQL, with table name as parameter?

How do 开发者_开发百科you to find last identity insert value in MySQL, with table name as parameter?

When I use the LAST_INSERT_ID() keyword, I can't get the table name.


You can not do that, indeed.

I suggest you to work it at the application level - in PHP/Python/Ruby/Perl, etc


There is no such functionality, due to scope issues.
Without calling LAST_INSERT_ID in the context of a transaction, there is no way to know if the value is actually related to your insert or someone else's.

0

精彩评论

暂无评论...
验证码 换一张
取 消