- 浏览: 940877 次
- 性别:
- 来自: 广州
文章分类
- 全部博客 (306)
- spring (20)
- ext (15)
- 其它综合 (8)
- svn (6)
- struts (1)
- java综合 (27)
- javascript (19)
- jquery (9)
- linux (56)
- tomcat (10)
- 数据库 (37)
- hibernate (9)
- seo (2)
- web前端 (3)
- 生活 (3)
- 软硬件 (11)
- python (5)
- apache (10)
- spring security (3)
- 好书分享 (4)
- ant (2)
- hudson (1)
- php (2)
- android (3)
- nginx (6)
- memcached (2)
- Tapestry (1)
- nodejs (2)
- cygwin (4)
- jboss (8)
- windows server (2)
- poi (1)
- css (5)
- weblogic (2)
- activemq (0)
- centos (4)
- sybase (1)
- lucene (2)
- daemontools (1)
- rabbitmq (2)
- zookeeper (1)
- nagios (1)
- jetty (4)
- ivy (1)
- maven (3)
- mysql (2)
- java设计 (1)
- redis (2)
- 二维码 (1)
- github (1)
最新评论
-
837030601:
很棒,虽然看不懂,楼主能给小白解释下不,解决问题了
mvn jetty:run 启动很慢解决办法 -
jevmok:
第二种方式错误无法添加;
jetty8 添加静态文件目录 -
JavaAiHaoZhezh:
...
spring在filter中注入bean -
zhanglongbin:
感谢楼主分享!!我遇到的问题:本地word转html 两个编码 ...
poi完美word转html(表格、图片、样式) -
wjs876046992:
文档编号显示不对,读出来全是1和1.1,我的文档是1,1.1, ...
poi完美word转html(表格、图片、样式)
转。
mysql> UPDATE EACONTACTGROUPS A
SET GROUPNAME=(SELECT CONCAT(B.GROUPNAME,'-',A.GROUPNAME) FROM EACONTACTGROUPS B WHERE B.CORPID=A.CORPID AND B.USERID=A.USERID AND B.GROUPID=A.PARENTGROUPID)
WHERE A.PARENTGROUPID IS NOT NULL;
ERROR 1093 (HY000): You can't specify target table 'A' for update in FROM clause
上面是目前MYSQL5.0仍然有的限制,文档中说:
In general, you cannot modify a table and select from the same table in a subquery. For example, this limitation applies to statements of the following forms:
DELETE FROM t WHERE ... (SELECT ... FROM t ...);UPDATE t ... WHERE col = (SELECT ... FROM t ...);{INSERT|REPLACE} INTO t (SELECT ... FROM t ...);
Exception: The preceding prohibition does not apply if you are using a subquery for the modified table in the
FROM
clause. Example:
UPDATE t ... WHERE col = (SELECT (SELECT ... FROM t...) AS _t ...);
Here the prohibition does not apply because a subquery in the
FROM
clause is materialized as a temporary table, so the relevant rows in
t
have already been selected by the time the update to
t
takes place. 依据文档,改成下面的样子就行了:
mysql> UPDATE EACONTACTGROUPS A
SET GROUPNAME=(SELECT CONCAT(B.GROUPNAME,'-',A.GROUPNAME) FROM ( SELECT GROUPNAME,CORPID,USERID,GROUPID,PARENTGROUPID FROM EACONTACTGROUPS) B
WHERE B.CORPID=A.CORPID AND B.USERID=A.USERID AND B.GROUPID=A.PARENTGROUPID)
WHERE A.PARENTGROUPID IS NOT NULL;
Query OK, 16 rows affected (0.01 sec)
Rows matched: 16 Changed: 16 Warnings: 0
注:今天写一个删除语句时找到的一点资料.解决了一个简单的删除语句.呵呵,以后注意了,
原句:delete from menu_item where parent_id =(select menu_item_id from menu_item where menu_data like '%manageVendors%');
修改后:delete from menu_item where parent_id =(select temp.menu_item_id from (select m.menu_item_id,m.menu_data from menu_item m) temp where temp.menu_data like '%manageVendors%');
mysql> UPDATE EACONTACTGROUPS A
SET GROUPNAME=(SELECT CONCAT(B.GROUPNAME,'-',A.GROUPNAME) FROM EACONTACTGROUPS B WHERE B.CORPID=A.CORPID AND B.USERID=A.USERID AND B.GROUPID=A.PARENTGROUPID)
WHERE A.PARENTGROUPID IS NOT NULL;
ERROR 1093 (HY000): You can't specify target table 'A' for update in FROM clause
上面是目前MYSQL5.0仍然有的限制,文档中说:
In general, you cannot modify a table and select from the same table in a subquery. For example, this limitation applies to statements of the following forms:
DELETE FROM t WHERE ... (SELECT ... FROM t ...);UPDATE t ... WHERE col = (SELECT ... FROM t ...);{INSERT|REPLACE} INTO t (SELECT ... FROM t ...);
Exception: The preceding prohibition does not apply if you are using a subquery for the modified table in the
FROM
clause. Example:
UPDATE t ... WHERE col = (SELECT (SELECT ... FROM t...) AS _t ...);
Here the prohibition does not apply because a subquery in the
FROM
clause is materialized as a temporary table, so the relevant rows in
t
have already been selected by the time the update to
t
takes place. 依据文档,改成下面的样子就行了:
mysql> UPDATE EACONTACTGROUPS A
SET GROUPNAME=(SELECT CONCAT(B.GROUPNAME,'-',A.GROUPNAME) FROM ( SELECT GROUPNAME,CORPID,USERID,GROUPID,PARENTGROUPID FROM EACONTACTGROUPS) B
WHERE B.CORPID=A.CORPID AND B.USERID=A.USERID AND B.GROUPID=A.PARENTGROUPID)
WHERE A.PARENTGROUPID IS NOT NULL;
Query OK, 16 rows affected (0.01 sec)
Rows matched: 16 Changed: 16 Warnings: 0
注:今天写一个删除语句时找到的一点资料.解决了一个简单的删除语句.呵呵,以后注意了,
原句:delete from menu_item where parent_id =(select menu_item_id from menu_item where menu_data like '%manageVendors%');
修改后:delete from menu_item where parent_id =(select temp.menu_item_id from (select m.menu_item_id,m.menu_data from menu_item m) temp where temp.menu_data like '%manageVendors%');
发表评论
-
Error: 1175 SQLSTATE: HY000 (ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE)
2013-08-08 14:15 968Solution: SET SQL_SAFE_UPDATES ... -
mysql: Communications link failure
2013-05-16 11:41 1394使用Connector/J连接MySQL数据库,程序运行较长时 ... -
MySQL实现rownum
2011-11-28 13:53 1660SELECT @rownum:=@rownum+1 AS ro ... -
MySQL concat 数字
2011-11-12 12:45 1509MySQL中concat函数 select concat(CA ... -
【解决】MySQL…Manager of pid-file quit without updating
2011-09-28 19:52 1320MySQL…Manager of pid-file quit ... -
mysql linux定时杀掉sleep进程
2011-09-22 11:01 2164echo "`date` killing mysql ... -
【解决】mysqldump: Got error: 1044: Access denied…when using LOCK TABLES
2011-09-01 10:43 1576加上-skip-lock-tables选项即可。即: ... -
mysql 优化
2011-08-22 16:38 879原文:http://www.001pp.com/chengxu ... -
【解决】mysql now() Incorrect datetime value for column
2011-08-20 17:45 3076mysql> select now(); select ... -
删除MySql-bin.0000X日志文件
2011-08-20 17:30 1131mysql-bin.0000X是mysql的操作日志文件,小则 ... -
【解决】Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.soc
2011-08-20 17:23 5968启动mysql报错: Can't connect to loc ... -
mysql skip-name-resolve和skip-grant-tables
2011-07-10 00:03 3471skip-name-resolve 此语句用于跳过dns域名 ... -
mysql 自定义变量随mysql启动而生效
2011-07-09 18:18 1912当我想要mysql的job服务时,我需要先执行: SET GL ... -
mysql dump报Access denied for user 'root'@'localhost' to XX when using LOCK TABLE
2011-07-08 12:47 2089mysqldump -u root -ppassword -- ... -
mysql 忘记密码或者报 'Access denied for user 'root'@'localhost' (using password: YES)'
2011-07-08 12:45 1391mysql 忘记密码或者报 'Access denied fo ... -
mysql中文乱码终极解决方法
2011-07-03 21:38 1067适合 linux and windows。 1.确定这些参数 ... -
mysql备份与恢复
2011-07-02 23:49 724转至http://blog.csdn.net/feng_sun ... -
linux查看mysql版本号
2011-07-02 23:35 42571:在终端下:mysql -V。 以下是代码片段: [she ... -
远程连接mysql
2011-07-02 22:26 1022查看当前连接数据库的用户与host: use mysql; S ... -
MySql数据库的列类型(字段类型)
2011-06-04 21:36 1165MySQL数据库的表是一个 ...
相关推荐
100日期: 2012-8-14事件: 8:07:59用户: N/A计算机: abcserver描述: 代码如下:Cannot find or open table phpwind/pw_zhuanti from the internal data dictionary of InnoDB though the .frm file for the table ...
network for single target tracking. We show that LSTMs outperform Kalman ltering for single target prediction by 2x. We also present a unique model for training two dependent LSTMs to output a ...
@Table(name = "datacenter") public class DataCenter { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private long centerID; private String centerName; // getter and setter } ``` 接下来...
信息安全_数据安全_If you cant trust the phone comp 安全风险 边界防御 企业安全 漏洞分析 安全开发
AS-23-Uhlmann-You-Can-Run-But-You-Cant-Hide
在MySQL中创建外键时,可能会遇到“Can't create table”这样的错误,这通常是由于多种原因造成的。以下是一些常见的导致外键创建失败的原因及其解决方法: 1. 字段类型和大小不匹配:确保主键和外键字段的类型完全...
come into play for understanding many of the important results in quantum Shannon theory">The aim of this book is to develop from the ground up" all of the major exciting preand post millenium ...
本文是我自己的一些学习iptables的心得,给大家拿出来来晒晒! filter #用于过滤 nat #做NAT input =>filter #目的ip是本机的数据包 forward =>filter #穿过本机的数据包 ...prerouting =>nat #修改目的地址(DNAT) ...
After a comprehensive literature review on the benefits of AR for several industrial applications in design, education and training, KPIs were extracted and evaluated by experts from the automotive ...
This is yet another jQuery plugin to provide fixed headers for tables. It differs in the way that it does not require any odd html table semantics. It just needs a TABLE tag with THEAD and TBODY to ...
解决libarcsoft_face.dll:Cant‘t find dependent library报错,相关文章:https://blog.csdn.net/chw0629/article/details/122557038
Socially-intelligent agents are of growing interest in artificial intelligence. To this end, we need ... and results in significant improvement over previous methods for social relationship recognition.
标题 "解决Can't locate ThreadQueue.pm" 指出的问题是,在尝试运行一个Perl脚本时,系统无法找到模块“ThreadQueue”。这个问题通常出现在你试图使用一个依赖于ThreadQueue模块的Perl程序,但该模块尚未在你的Perl...
解决mongo数据插入时 报错问题 mogodb插入数据时报错Can't find a codec for class java.math.BigDecimal
AND cant_code NOT IN ('520000', '530000', '450000', '460000', '440000') START WITH cant_code = 'CN' ) ) SELECT * FROM tas CONNECT BY PRIOR cant_code = super_code AND LEVEL START WITH cant_code = '...
Large-scale Network Simulations in Kubernetes.pptx [ONSEU2019] CNF Testbed Tutorial 5G RAN Optimization Using the ...Who Says You Cant Run VMs and Containers Zero Trust, Software Defined Perimeter and P4