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'
where id in (select t.id from company_info t where t.id<3)

修改后可执行的sql:

update company_info set email = 'ttt@163.com'
where id in (select a.id from (select t.id from company_info t where t.id<3)a )

Mysql update in报错 [Err] 1093 - You can't specify target table 'company_info' for update in FROM clause的更多相关文章

  1. 关于mysql 5.7版本“报[Err] 1093 - You can't specify target table 'XXX' for update in FROM clause”错误的bug

    不同于oracle和sqlserver,mysql并不支持在更新某个表的数据时又查询了它,而查询的数据又做了更新的条件,因此我们需要使用如下的语句绕过: , notice_code ) a) ; 本地 ...

  2. [Err] 1093 - You can't specify target table 's' for update in FROM clause

    [Err] 1093 - You can't specify target table 's' for update in FROM clause 执行SQL DELETE from book WHE ...

  3. MySQL: [Err] 1093 - You can't specify target table 'bk' for update in FROM clause

    错误的意思说,不能先select出同一表中的某些值,再update这个表(在同一语句中). 例如下面这个sql: delete from tbl where id in (        select ...

  4. [Err] 1093 - You can't specify target table 'master_data' for update in FROM clause

    delete from master_data where category_id not in (select category_id from master_data a, bc_category ...

  5. MySQL 1093 - You can't specify target table 'sc' for update in FROM clause

    错误代码如下: #(8) 把"邓维杰"同学的成绩全部删除. SELECT * FROM sc WHERE EXISTS(SELECT * FROM student WHERE st ...

  6. MySQL中执行sql语句错误 Error Code: 1093. You can't specify target table 'car' for update in FROM clause

    MySQL中执行sql语句错误 Error Code: 1093. You can't specify target table 'car' for update in FROM clause 201 ...

  7. 1093 - You can't specify target table 'account' for update in FROM clause

    目的:查询一张表的相同的两条数据,并删除一条数据. 分析 先查询出相同的数据,然后删除 查询相同的数据 SELECT a.id FROM account a GROUP BY a.username H ...

  8. django.db.utils.OperationalError: (1093, "You can't specify target table 'xxx' for update in FROM clause")

    这个错误的意思是,不能在update某张表的where条件中,再次select这张表的某些值作为筛选条件,比如: update message set content = "hello&qu ...

  9. mysql 1093 - You can't specify target table 'xx表' for update in FROM clause

    为了修复节点表某批次数据的用户数据,做出了以下尝试: , name , , )); 执行:[Err] 1093 - You can't specify target table 'zs_work_ap ...

随机推荐

  1. mysql的读写分离

    1.laravel实现数据库读写分离配置或者多读写分离配置 config\database.php里配置 'connections' => array(      //默认mysql配置,访问t ...

  2. Pyhton编程(四)之基本数据类型-字符串详解

    一:字符串是什么? 字符串是Python最常用的一种数据类型,虽然看似简单,但能够以不同的方式来使用它们. 字符串就是一系列的字符,在Python中,用引号括起来的都是字符串,其中的引号可以是单引号, ...

  3. dubbo的架构

    dubbo架构图如下所示: 节点角色说明: Provider: 暴露服务的服务提供方. Consumer: 调用远程服务的服务消费方. Registry: 服务注册与发现的注册中心. Monitor: ...

  4. sql执行报错--This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'

    问题: 不支持使用 LIMIT 子句的 IN/ALL/ANY/SOME 子查询,即是支持非 IN/ALL/ANY/SOME 子查询的 LIMIT 子查询. 解决: 将语句:select * from ...

  5. IP核之初——FIFO添加以太网MAC头部

    本文设计思路源自明德扬至简设计法.在之前的几篇博文中,由于设计比较简单,所有的功能都是用verilogHDL代码编写实现的.我们要学会站在巨人的肩膀上,这时候就该IP核登场了! 说白了,IP核就是别人 ...

  6. Yii2之属性

    一直以来,在我的理解中,类的成员变量和属性就是同一个东西,直到看了<深入理解Yii2.0>才明白,类的成员变量和属性其实不是同一个概念,成员变量是就类的结构构成而言的概念,而属性是就类的功 ...

  7. SQL——按照季度,固定时间段,分组统计数据

    最近在工作中接到了一个需求,要求统计当月以10天为一个周期,每个周期的数据汇总信息.假设有一张表如下: 表table_test中 ID           AMOUNT         CREATE_ ...

  8. SQL Server远程连接(2)

  9. DataProtection Key的选择

    代码位于: Microsoft.AspNetCore.DataProtection.KeyManagement.DefaultKeyResolver.cs private IKey FindDefau ...

  10. ORACLE使用数据泵导入导出部分表

    1.导出名字为A的表(这里会导出SEQUENCES及FUNCTION等内容) expdp TEST/TEST@orcl schemas=TEST dumpfile=TEST.dmp DIRECTORY ...