mysql错误:1093-You can’t specify target table for update in FROM clause的解决方法
来源:互联网 发布:linux 文件共享服务器 编辑:程序博客网 时间:2024/05/18 03:23
update语句中包含的子查询的表和update的表为同一张表时,报错:1093-You can’t specify target table for update in FROM clause
mysql不允许update目标表和子查询里面的表为同一张表
错误sql:
UPDATE mg_brand set `status`='0' where iID=(SELECT id from mg_industry where `name`='汽车') and id in (SELECT id from mg_brand WHERE nameC = '欧宝' or pID = (SELECT id from mg_brand WHERE nameC = '欧宝'));
解决办法:子查询sql可以改变双层的子查询,即可执行成功
示例sql:
UPDATE mg_brand SET `status` = '0' WHERE iID = ( SELECT id FROM mg_industry WHERE `name` = '汽车' ) AND id IN ( SELECT id FROM (SELECT id FROM mg_brand) AS temp WHERE nameC = '欧宝' OR pID = ( SELECT id FROM ( SELECT id FROM mg_brand WHERE nameC = '欧宝' ) AS te WHERE 1 ));
阅读全文
0 0
- mysql错误:1093-You can’t specify target table for update in FROM clause的解决方法
- mysql 出现You can't specify target table for update in FROM clause错误的解决方法
- mysql中错误:1093-You can’t specify target table for update in FROM clause的解决方法
- MySQL "You can't specify target table 'X' for update in FROM clause" 错误解决方法
- mysql中You can’t specify target table for update in FROM clause错误解决方法
- mysql中You can’t specify target table for update in FROM clause错误解决方法
- mysql 中 You can't specify target table <tbl> for update in FROM clause 错误解决方法
- mysql中You can’t specify target table for update in FROM clause错误解决方法
- mysql中You can’t specify target table for update in FROM clause错误解决方法
- mysql中You can’t specify target table for update in FROM clause错误解决方法
- mysql中You can’t specify target table for update in FROM clause错误解决方法
- mysql中You can’t specify target table for update in FROM clause错误解决方法
- 关于mysql "You can't specify target table 'test_zb_scene' for update in FROM clause"的错误
- MySQL 错误码: 1093 You can't specify target table 'jc_user' for update in FROM clause
- mysql的1093错误You can't specify target table 't' for update in FROM clause 简单解决
- mysql You can't specify target table for update in FROM clause解决方法
- mysql中You can't specify target table for update in FROM clause错误
- Mysql 错误 Code: 1093. You can't specify target table for update in FROM clause
- 申请开通微信h5支付,网站域名ICP备案主体与商户号主体不一致的解决方法
- Spring(五)---面向切面的编程
- 持久层mybatis的sql向sqlserver插入数据,带小数位的数字字符串自动四舍五入
- 输出一个菱形
- 控制反转(IOC)、依赖注入(DI)之通过构造函数注入对象
- mysql错误:1093-You can’t specify target table for update in FROM clause的解决方法
- 关于CSS编码规范的文章
- Android四大组件(ContentProvider篇)
- Java NIO入门与详解
- EBS开发常见问题及学习方向总结
- Java小应用日志级别异常处理最佳实践
- .NET代码混淆
- CSS常用选择器介绍
- opencv2 用imwrite 抽取并保存视频图像帧