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开始 ...
随机推荐
- 使用Eclipse搭建C/C++开发环境(转)
使用Eclipse搭建C/C++开发环境 文章出自:http://www.cnblogs.com/liuxianan/archive/2013/01/15/2861196.html 说明:网上有很多 ...
- 内置方法+lambda是pythonic的利器
python可以写的非常简洁,通过使用内置的map,reduce,filter,lambda方法,非常具有文艺范. 举个例子,例如 def fromIpToNum(ipAddr): return ...
- Python中%s和%r的区别
早先使用Python工作的时候,对于格式化输出%s和%r的使用都是混着用的. 这一次就出错了: cu.execute("insert into ipPool values(null, '%r ...
- C# WinFrom 编写正则表达式验证类
public class ValidationRegex { /// <summary> /// 正则表达式字符串 /// </summary> public static s ...
- mysql,left join on
转自http://www.oschina.net/question/89964_65912 觉得很有帮助,用来学习. 即使你认为自己已对 MySQL 的 LEFT JOIN 理解深刻,但我敢打赌,这篇 ...
- python之json
import json import requests re = requests.get('http://wthrcdn.etouch.cn/weather_mini?city=成都') re.en ...
- H - A+B for Input-Output Practice (VII)
Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Description You ...
- uva12538
12538 Version Controlled IDEProgrammers use version control systems to manage files in their project ...
- 搞Solr这一年(本人QQ 282335345 群412268049 欢迎大家一起学习Solr 非诚勿扰)
搞Solr这一年 去年6月份毕业到现在已经快一年半了,很庆幸从事了搜索引擎这份工作,虽然谈不上有多深入,但至少已经入门了.在这一年半里,搞了3个月的hbase和mapreduce,搞了一个月的nutc ...
- C# WinForm的SplitContainer控件固定Panel大小[转]
原文地址:http://zhidao.baidu.com/link?url=mhkUszZ8am_vqNX3KAOff-psd3af7Xl3DL77KxJ-rWIAqIArQHzQIEBoX49mQA ...