做地址管理时,需要先根据要设为默认的地址的用户将用户的其他地址都设置为非默认 需要select出用户id然后update 原语句 update address set isdeafult = 0 where user_id = (select user_id from address where id = ?) 报错 -- You can't specify target table 'address' for update in FROM clause 大意是不能先select出同一表中的某些…
mysql中You can't specify target table for update in FROM clause错误的意思是说,不能先select出同一表中的某些值,再update这个表(在同一语句中). 例:DELETE from sys_org_relation where pOrgid in ( select porgId from sys_org_relation   r  where  r.corgid='客户id' and relationType=1112 )  and…
DELETE from sp_goodscontent where goodsId in (SELECT t.goodsId from ( SELECT goodsId FROM sp_goodscontent GROUP BY goodsId HAVING count(1)>1 ) t) 之前的sql 查询,需要改成中间临时表再查询…
含义:您不能在子句中为更新指定目标表'xxx'. 错误描述:删除语句中直接含select,如下: DELETE FROM meriadianannotation WHERE SeriesID IN ( SELECT SeriesID as tid FROM meriadianannotation GROUP BY SeriesID HAVING count(SeriesID) > 1 ) AND data NOT IN ( SELECT min(data) as bid FROM meriadi…
错误语句: DELETE from sys_right_menu where right_id  in (SELECT m.right_id from sys_right_menu  mLEFT JOIN sys_right  r on r.right_id=m.right_idWHERE r.right_id is null) 更正后: DELETE from sys_right_menu where right_id  in (SELECT right_id from (SELECT m.r…
这个问题是不能先select出同一表中的某些值,再update这个表(在同一语句中),即不能依据某字段值做判断再来更新某字段的值.解决办法就是建立个临时的表.…
问题描述:有个数据表test,有个字段value,如下 mysql> select * from test;+----+------------------------------------+| id | value |+----+------------------------------------+| 3 | 3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa || 4 | 4aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa || 5 | 5aaaaaaa…
Mysql update in报错 解决方案: [Err] 1093 - You can't specify target table 'company_info' for update in FROM clause 意思是不能在同一语句中更新select出的同一张表元组的属性值 解决方法:将select出的结果通过中间表再select一遍即可. 错误sql: update company_info set email = 'ttt@163.com' ) 修改后可执行的sql: update c…
MySQL中执行sql语句错误 Error Code: 1093. You can't specify target table 'car' for update in FROM clause 2017年03月21日 11:32:46 回归心灵 阅读数:686   版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/u010657094/article/details/64439486 当执行以下sql语句时会出现 Error Code:1093 错…
不同于oracle和sqlserver,mysql并不支持在更新某个表的数据时又查询了它,而查询的数据又做了更新的条件,因此我们需要使用如下的语句绕过: , notice_code ) a) ; 本地测试是通过的,但是在上到测试环境的时候,发现还是会报如下错误: , notice_code ) a) ; - You can't specify target table 'teaching_department' for update in FROM clause 对比版本发现,本地是5.6.25…