MySql 使用嵌套查询更新查询
MySql Update Query using nested Query
我只想更新 table 日志的最后一行..按 ID 字段升序排列..以下查询给出错误
update Inventory.logs as a set a.Session=90 where a.ID=(select max(ID) from Inventory.logs)
给出错误
you cant specify target table a for update in From Clause
试试这个代码
我希望这是有益的
update Inventory.logs set Session=90 order by id desc limit 1
我只想更新 table 日志的最后一行..按 ID 字段升序排列..以下查询给出错误
update Inventory.logs as a set a.Session=90 where a.ID=(select max(ID) from Inventory.logs)
给出错误
you cant specify target table a for update in From Clause
试试这个代码 我希望这是有益的
update Inventory.logs set Session=90 order by id desc limit 1