You can't specify target table 'item' for update in FROM clause
来源:互联网 发布:java随机数生成器 编辑:程序博客网 时间:2024/05/29 15:03
今天写sql处理历史数据时,报出标题的错误,sql如下:
UPDATE itemSET platf_min_sell_price = NULL, platf_max_sell_price = NULLWHERE item_id IN ( SELECT DISTINCT item_id FROM item_sku WHERE sku_id IN ( SELECT sku_id FROM trade_sku_price WHERE item_id IN ( SELECT item_id FROM item WHERE platform_id = 123456 AND platf_min_sell_price IS NOT NULL AND platf_max_sell_price IS NOT NULL ) ) AND attributes IS NOT NULL )
意思大概就是你不能一边查着item表一边修改它,否则可能会引起问题。
stackoverflow给出的一种解决办法是,把子句查询结果存放到临时表中,修改后的sql如下:
UPDATE itemSET platf_min_sell_price = NULL, platf_max_sell_price = NULLWHERE item_id IN ( SELECT item_id FROM ( ( ( SELECT DISTINCT item_id FROM item_sku WHERE sku_id IN ( SELECT sku_id FROM trade_sku_price WHERE item_id IN ( SELECT item_id FROM item WHERE platform_id = 123456 AND platf_min_sell_price IS NOT NULL AND platf_max_sell_price IS NOT NULL ) ) AND attributes IS NOT NULL ) ) ) AS t )
阅读全文
0 0
- You can't specify target table 'item' for update in FROM clause
- mysql update语句问题:You can't specify target table 'user' for update in FROM clause
- You can't specify target table 'table name' for update in FROM clause
- MySql报错: You can't specify target table 'table name' for update in FROM clause
- 【MySQL】1093 You can't specify target table 'table name' for update in FROM clause
- [Err] 1093 - You can't specify target table 'table' for update in FROM clause处理
- You can't specify target table 't' for update in FROM clause
- Mysql - You can't specify target table 'dataproduct' for update in FROM clause
- You can't specify target table 'wms_cabinet_form' for update in FROM clause
- MySQL报错“ you can't specify the target table for ‘update’ in from clause”
- You can't specify target table 'sc1' for update in FROM clause
- [Err] 1093 - You can't specify target table 's' for update in FROM clause
- mysql中You can't specify target table for update in FROM clause错误
- You can't specify target table 'sdb_goods' for update in FROM clause
- You can't specify target table 'A' for update in FROM clause
- MYSQL 临时表 #1093 - You can't specify target table 'dealer_admin' for update in FROM clause
- MySQL "You can't specify target table 'X' for update in FROM clause" 错误解决方法
- Mysql 错误 Code: 1093. You can't specify target table for update in FROM clause
- Python_uwsgi_restart
- selenium使用POI导入导出excel
- 深圳中科爱讯科技有限公司
- iOS开发之ReactiveCocoa框架(RAC)第四篇构建一个信号量
- Wunder Fund Round 2016 (Div. 1 + Div. 2 combined) C. Constellation(思维 简单几何)
- You can't specify target table 'item' for update in FROM clause
- 常用设计模式之抽象工厂模式
- MySQL 5.7 主从配置
- bat批处理之批量安装卸载apk
- Activity中重载的dispatchTouchEvent 和 onTouchEvent不被调用
- linux双网卡绑定
- 浅谈react和Vue传值问题
- matlab入门教程九 ----- 数据输入与处理
- 《编程之美》学而思