批量修改,带有子查询语句,报错 Error Code: 1093. You can't specify target table 't' for update in FROM clause 0.000 sec
错误的语句
update t_wx_menu t set
t.del_flag = 1,
t.update_time = now()
where t.id in (select b.id from t_wx_menu a join t_wx_menu b on a.id = b.pid where a.id = 19)
修改为:
update t_wx_menu t set
t.del_flag = 1,t.update_time = now()
where t.id in (select id from (select b.id AS id from t_wx_menu a join t_wx_menu b on a.id = b.pid where a.id = 19) as temtable)