sql更新数据不能有from的异常解决方案

sql更新数据不能有from的错误解决方案You cant specify target table tbl_total_log for update in FRO

sql更新数据不能有from的错误解决方案

You can't specify target table 'tbl_total_log' for update in FROM clause


update tbl_total_log set unassigned = unassigned - 199 where id = (select id from (select max(id) id from tbl_total_log) tbl_temp);Query OK, 1 row affectedRows matched: 1  Changed: 1  Warnings: 0


select * from tbl_total_log where id = (select id from (select max(id) id from tbl_total_log) tbl_temp);1 row in set



http://www.xaprb.com/blog/2006/06/23/how-to-select-from-an-update-target-in-mysql/