您好,欢迎访问一九零五行业门户网

mysql update in 报错解决

在用到mysql update in的时候报错 update area set status='on' where id in(select id from area where status='on' and name like '%市辖%') [sql]update area set status='on' where id in(select id from area where status='on' and name like '%市辖%'
在用到mysql  update in的时候报错
update area set status='on' where id in(select id from area where status='on' and name like '%市辖%')
[sql]update area set status='on' where id in(select id from area where status='on' and name like '%市辖%')
[err] 1093 - you can't specify target table 'area' for update in from clause
下面语句可以通过
update area a inner join(select id from area where id in(select id from area where status='on' and name like '%市辖%')) b on a.id=b.id set a.status='off'select * from area a inner join(select id from area where id in(select id from area where status='on' and name like '%市辖%')) b on a.id=b.id
其它类似信息

推荐信息