mysql中You can't specify target table for update in FROM clause错误的意思是说,不能先select出同一表中的某些值,再update这个表(在同一语句中) 例如 delete from table名称 where idStr in ( ) ); 就会报上面的错误 改 delete from table名称 where idStr in ( ) c from table名称 h group by h.otherKey ) s ); 通过中…
mysql中You can't specify target table for update in FROM clause错误的意思是说,不能先select出同一表中的某些值,再update这个表(在同一语句中). 例如下面这个sql: delete from tbl where id in ( select max(id) from tbl a where EXISTS ( ) ) group by tac ) 改写成下面就行了: delete from tbl where id in (…
mysql 一个较特殊的问题:You can't specify target table for update in FROM clause 即:不能先select出同一表中的某些值,再update这个表(在同一语句中),解决方案:查询时为表定义一个别名在取值 eg: UPDATE `EDMGR_FORM_BASICINFO` SET `EDMGR_FORM_BASICINFO`.`BELONG_DOMAIN` = '' WHERE `EDMGR_FORM_BASICINFO`.`C_TYPE…
使用mysql在删除表中重复记录 delete from user where username in (select user name form(select username from user group by username having count(username)>1)); 遇到mysql报错You can't specify target table for update in FROM clause 上网百度了下原来是mysql中不允许先select出同一表中的某些值,再u…
这篇文章主要介绍了mysql中You can't specify target table for update in FROM clause错误解决方法,需要的朋友可以参考下 MySQL中You can't specify target table for update in FROM clause错误的意思是说,不能先select出同一表中的某些值,再update这个表(在同一语句中). 例如下面这个sql: 复制代码代码如下: delete from tbl where id in (  …
MySQL出现You can’t specify target table for update in FROM clause 这个错误的意思是不能在同一个sql语句中,先select同一个表的某些值,然后再update这个表. 例如:message表保存了多个用户的消息 创建表 CREATE TABLE `message` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `uid` int(10) unsigned NOT NULL, `con…
You can't specify target table for update in FROM clause含义:不能在同一表中查询的数据作为同一表的更新数据. 出现以上错误,是因为想将表自身的字段A的值作为被更新字段B的值而导致的. "自身更新自身"的正确写法: UPDATE t_loan SET f_biddingAmount = ( SELECT amount FROM( SELECT ln.*, ln.f_amount amount FROM t_loan ln ) lnn…
mysql中You can't specify target table for update in FROM clause错误的意思是说,不能先select出同一表中的某些值,再update这个表(在同一语句中). 例如下面这个sql: delete from tbl where id in ( select max(id) from tbl a where EXISTS ( )> ) group by tac ) 改写成下面就行了: delete from tbl where id in (…
mysql中You can't specify target table for update in FROM clause错误的意思是说,不能先select出同一表中的某些值,再update这个表(在同一语句中). 例如下面这个sql: 代码如下: delete from tbl where id in ( select max(id) from tbl a where EXISTS ( select 1 from tbl b where a.tac=b.tac group by tac HA…
将select出的结果再通过中间表select一遍,这样就规避了错误.注意,这个问题只出现于mysql,mssql和oracle不会出现此问题. mysql中You can't specify target table for update in FROM clause错误的意思是说,不能先select出同一表中的某些值,再update这个表(在同一语句中). later: But: Subquery returns more than 1 row表示子查询返回了多行数据 开始: delete…