MySQL can’t specify target table for update in FROM clause
来源:互联网 发布:java filter过滤器 编辑:程序博客网 时间:2024/06/14 13:22
翻译:MySQL不能指定更新的目标表在FROM子句
源SQL语句:
delete from t_official_sys_userwhere USER_NAME IN(SELECT USER_NAME FROM t_official_sys_user b group by b.`USER_NAME` having count(1) > 1)
执行报以下错误:
[SQL] delete from t_official_sys_userwhere USER_NAME IN(SELECT USER_NAME FROM t_official_sys_user b group by b.`USER_NAME` having count(1) > 1)[Err] 1093 - You can't specify target table 't_official_sys_user' for update in FROM clause
解决代码如下:
delete from t_official_sys_userwhere USER_NAME IN(select USER_NAME from ( SELECT USER_NAME FROM t_official_sys_user b group by b.`USER_NAME` having count(1) > 1) as temtable );
分析:
先把要删除的目标放到一张临时表再把要删除的条件指定到这张临时表即可。
1 0
- mysql update语句问题:You can't specify target table 'user' 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
- Mysql - You can't specify target table 'dataproduct' for update in FROM clause
- MySQL报错“ you can't specify the 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 '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
- 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 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 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 ‘A’ for update in FROM clause
- MySQL:You can’t specify target table ‘A’ for update in FROM clause
- 游戏开发经验分享:我所理解的打击感
- 发现的jlink RTT 的一个优点
- autolayout - sizeClass - 3
- Day10(下).面向对象编程强化
- 泛型之中的通配符(Wildcards)使用
- MySQL can’t specify target table for update in FROM clause
- Extjs4 grid相关配置以及应用
- Spring MVC 定时器分析例子
- php 文件缓存类
- Google 镜像站搜集
- JSP-MVC初学小结-记录
- Camera Binning Mode
- ormlite 排序
- Android开发之HttpURLConnection