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错误解决方法,需要的朋友可以参考下 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错误的意思是说,不能先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解决方法出现这个错误的原因是不能在同一个sql语句中,先select同一个表的某些值,然后再update这个表. <pre>mysql> update message set content='Hello World' where id in(select min(id) from message group by uid);ERROR 1093 (HY000):…
update语句中包含的子查询的表和update的表为同一张表时,报错:1093-You can’t specify target table for update in FROM clause mysql不允许update目标表和子查询里面的表为同一张表 错误sql:UPDATE mg_brand set `status`='0' where iID=(SELECT id from mg_industry where `name`='汽车') and id in (SELECT id from…
表中出现重复数据,需要删除重复数据,只保留一条 DELETE FROM crm_participant WHERE id IN ( SELECT c.id cid FROM crm_participant c WHERE c.parentPhone IN ( SELECT a.parentPhone FROM crm_participant a GROUP BY a.parentPhone HAVING count( a.parentPhone ) > 1 ) AND c.id NOT IN (…
这句话意思是:不能先select再更新(修改)同一个表. 可以再外嵌套多一层,这个问题只有mysql有,mssql和oracle都没有. # 出错delete from Person where Id not in ( select min(Id) as Id from Person group by Email); # 正确delete from Person where Id not in ( select Id from ( select min(Id) as Id from Person…
使用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 这个错误的意思是不能在同一个sql语句中,先select同一个表的某些值,然后再update这个表. 例如:message表保存了多个用户的消息 创建表 CREATE TABLE `message` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `uid` int(10) unsigned NOT NULL, `con…
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…