Questions tagged «insert-id»


7
MySQL ON DUPLICATE KEY-最后插入ID?
我有以下查询: INSERT INTO table (a) VALUES (0) ON DUPLICATE KEY UPDATE a=1 我想要插入或更新的ID。通常我会运行第二个查询来获取此信息,因为我相信insert_id()仅返回“插入的” ID,而不返回更新的ID。 有没有一种方法可以在不运行两个查询的情况下进行INSERT / UPDATE和检索行ID?
132 mysql  insert-id 
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.