mysql提示#1093 – You can’t specify target table
mysql提示#1093 – You can’t specify target table ‘xxx’ for update in FROM clause
来看如下两个sql语句:
现在要实现的应用如下:把所有带“东京”的产品的dest_id改成 47
有如下写下: update product set destination_id=47 where product_id in( select product_id from product where name like '%东京%' )
但是这种sql在mysql中提示错误#1093 – You can’t specify target table ‘xxx’ for update in FROM clause
那可以改成如下写法 : update product set destination_id=47 where product_id in( select product_id from (select product_id from product where name like '%东京%') as temtable )
delete from member where id in (select tableTemp.id from (SELECT id from member where org_id in(SELECT id from organization where rank LIKE '%40000166%')) as tableTemp);
posted on 2013-07-07 15:19 阳光总在风雨后001 阅读(1329) 评论(0) 编辑 收藏 举报