MySQL更新时Error Code:1093和Error Code:1175的解决办法
Error Code: 1093. You can't specify target table 'ws_product' for update in FROM clause
这个是我们在使用update或者delete语句时,在where条件里面加入的子查询导致的。例如如下的update语句:
update table set type = 'static' where id in (
select id from ws_product where first_name ='superman'
);
修改上述语句为下面这样,该问题可以解决:
update ws_product set type = 'static' where id in (
select id form (
select id from ws_product where first_name ='superman'
) xx
);
注意,这样一定要给最里面的子查询定义一个别名,不然会报另外一个错误:
Error Code: 1248. Every derived table must have its own alias
Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column To disable safe mode, toggle the option in Preferences -> SQL Queries and reconnect.
解决办法是在当前session下执行如下的语句
SET SQL_SAFE_UPDATES = 0;
然后再执行Update语句
MySQL更新时Error Code:1093和Error Code:1175的解决办法的更多相关文章
- wamp中mysql安装时能启动,重启后无法启动的解决办法
第一次安装wamp之后,所有服务可以正常使用,但是重启之后wamp的图标就变成黄色的了,重装了也这样 查看一下错误日志: 日志显示的错误是这样的: 日志提示可能是3306端口被占用的错误,那来看一下是 ...
- MySQL: Starting MySQL….. ERROR! The server quit without updating PID file解决办法
MySQL: Starting MySQL….. ERROR! The server quit without updating PID file解决办法 1 问题 [root@localhost m ...
- github上传时出现error: src refspec master does not match any解决办法
github上传时出现error: src refspec master does not match any解决办法 这个问题,我之前也遇到过,这次又遇到了只是时间间隔比较长了,为了防止以后再遇到类 ...
- Wincap安装出现“error opening file for writing wpcap.dll”之解决办法
Wincap安装出现"error opening file for writing wpcap.dll"之解决办法 安装Wireshark时,一直出现下面的错误,选择忽略这个错误, ...
- Centos下安装apahce的configure: error: APR not found. Please read the documentation解决办法
今天从Apache官网上http://httpd.apache.org/下载httpd web服务器,由于我的虚拟机上之前安装过,我先yum remove httpd进行卸载,然后重新安装.我采用的是 ...
- 转 configure: error: Cannot find ldap libraries in /usr/lib 解决办法
今天在centos 6.2 64位版本上安装LNMP,config php的时候出现下面错误而退出 configure: error: Cannot find ldap libraries in /u ...
- 转 Centos下安装apahce的configure: error: APR not found. Please read the documentation解决办法
转自: http://www.cnblogs.com/Anker/p/3355573.html 今天从Apache官网上http://httpd.apache.org/下载httpd web服务器,由 ...
- 重启mysql提示:The server quit without updating PID file问题的解决办法
今天因为需要开启事件调度器event_scheduler,所以修改了mysql的配置文件/etc/my.cnf 就因为配置多了个分号,导致一直启动失败,如下图所示: 然后去网上搜了帖子(MySQL提示 ...
- MySQL提示:The server quit without updating PID file问题的解决办法(转载)
MySQL提示:The server quit without updating PID file问题的解决办法 今天网站web页面提交内容到数据库,发现出错了,一直提交不了,数找了下原因,发现数据写 ...
- chart.js插件生成折线图时数据普遍较大时Y轴数据不从0开始的解决办法[bubuko.com]
chart.js插件生成折线图时数据普遍较大时Y轴数据不从0开始的解决办法,原文:http://bubuko.com/infodetail-328671.html 默认情况下如下图 Y轴并不是从0开始 ...
随机推荐
- SGU 119.Magic pairs
题意: 对于给出的一个整数N,和一对(A0,B0) 找到所有的整数对(A,B)满足 : 对于任意 X,Y 当 A0 * X + B0 * Y 能被 N 整除时 A * X + B * Y 也能被 N ...
- Java学习----你可以知道对象的工作结果(获取方法的返回值)
1.写返回类型 2.return 返回值 3.定义变量接受返回值 public class App2 { public String [] print(String msg, int num) { f ...
- js四舍五入的bug和方法
简单来说js使用原生toFixed(x)截取小数的时候会有误差,出现在比如var o = 0.3303;o.toFixed(3);//0.330 toFixed(x)本来也是一个获取四舍五入的截取方法 ...
- php数组基础
一.php数组的声明 1.数组中可以有任意类型的数据 2.长度可以变长 3.数组的分类: a.索引数组:数组是以从0开始的帧数作为索引值 ...
- CreateJS第1章 EaselJS基础 (画图)
这章学学EaselJS的基本常用API首先下载createjs库,在项目文件里新建一个js文件夹放里面http://code.createjs.com/ 各种形状 var sp = new creat ...
- atoi的实现
#include <iostream> using namespace std; int atoi(char* s) { int retval=0; int n=1; if (*s=='- ...
- AdminLTE
AdminLTE搭建前端 0 Asp.Net Core 项目实战之权限管理系统(0) 无中生有 1 Asp.Net Core 项目实战之权限管理系统(1) 使用AdminLTE搭建前端 2 Asp ...
- Linux——搭建PHP开发环境第四步:composer
原文链接:https://my.oschina.net/jiangbianwanghai/blog/473249 1.下载composer.phar [root#localhost opt]# cur ...
- 转:FIFO和DMA
FIFO SPI端口增加了FIFO,使得传输数据有了缓冲区间. FIFO存储器是一个先入先出的双口缓冲器,即第一个进入其内的数据第一个被移出,其中一个存储器的输入口,另一个口是存储器的输出口.主要有三 ...
- oracle timestamp的转换
select to_char(stime,'yyyy-mm-dd HH24:MI:ss.ff3') from e_bmp_log_operation t where t.sdetail like '% ...