The definition of table 'table1' prevents operation UPDATE on table 'table2' 的解决方法
2012-4-1 11:43 Sunday  

分类: MySQL 标签: item where table 会报 select 评论(73) 浏览(32459)

The definition of table 'table1' prevents operation UPDATE on table 'table2' 的解决方法

执行下面的SQL,就会报 The definition of table 'table1' prevents operation UPDATE on table 'table2'

update table2 set item = replace(item,'A27-','A28-')
where id in(select id from table1 where
 item like 'A27-%' and status>=1 and online=1)

修改为如下方式即可

update table2 set item = replace(item,'A27-','A28-')
where id in(select id from (select id from table1 where
 item like 'A27-%' and status>=1 and online=1) b)

 

 

 

 

 

 

+1 25

留下你的看法: