这个问题是mysql中的一个问题,类似于下面的查询语句:
update table1 set col1 = 1 where id not in (select parentid from table1);
就会出现这样的问题,
意思是说不能先从一张表里面查询出数据,然后再更新这张表;
解决的办法就是:
create table tmp as select col1 as col2 from table1;
update table1 set col1 = 1 where id not int (select col2 from tmp);
drop table tmp;
中间加个临时表就行了