LAST_INSERT_ID 返回当前会话的最后一个插入id。 只要不在当前连接中插入多个条目,它就有效。
LAST_INSERT_ID
更多信息请参见: https://dba.stackexchange.com/questions/21181/is-mysqls-last-insert-id-function-guaranteed-to-be-correct
(我会链接到mysql.com,但它目前已关闭)