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 affected
Rows 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
[url]http://www.xaprb.com/blog/2006/06/23/how-to-select-from-an-update-target-in-mysql/[/url]