mysql update in 报错解决

在用到mysql  update in的时候报错

update area set status=‘ON‘ where id in(select id from area where status=‘ON‘ and name like ‘%市辖%‘)

[SQL]update area set status=‘ON‘ where id in(select id from area where status=‘ON‘ and name like ‘%市辖%‘)

[Err] 1093 - You can‘t specify target table ‘area‘ for update in FROM clause

下面语句可以通过

update area a  inner join(select id from area where id in(select id from area where status='ON' and name like '%市辖%')) b on  a.id=b.id set a.status='OFF'

select * from area a inner join(select id from area where id in(select id from area where status='ON' and name like '%市辖%')) b on  a.id=b.id
时间: 2024-08-01 05:11:04

mysql update in 报错解决的相关文章

mysql初始化登录报错解决-1

场景还原: 初始化 #/usr/local/webserver/mysql/bin/mysql_install_db --user=mysql --basedir=/usr/local/webserver/mysql/ --datadir=/home/mysqldata Installing MySQL system tables...150205 11:48:00 [Note] Flashcache bypass: disabled150205 11:48:00 [Note] Flashcac

MySQL MRG_MyISAM 引擎报错解决

报错: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist 因此当遇到Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist报错的时候需要从如下几个方面入手: 1.查看是不是有一些表不是MYISAM引擎的表,

Kettle使用MySQL作为资源库报错解决方法

使用Kettle5.0.1,安装的是MySQL5.1.JDK1.6,在\data-integration\lib目录里添加mysql的JDBC包mysql-connector-java-5.0.8-bin.jar, 在新建资源库里设置好MySQL的各种信息,如下 点“测试”报如下错误 错误连接数据库 [本地MySQL的[test]数据库] : org.pentaho.di.core.exception.KettleDatabaseException: Error occured while tr

最终章·MySQL从入门到高可用架构报错解决

1. 报错原因:MySQL的socket文件目录不存在. 解决方法:创建MySQL的socket文件目录 mkdir /application/mysql-5.6.38/tmp 2. 报错原因:socket文件目录没有权限 解决方法:给socket文件目录授权mysql用户的权限 chown -R mysql.mysql /application/mysql-5.6.38/ 3. 报错原因:没有做初始化 解决方法:做初始化 ./mysql_install_db --user=mysql --ba

PHP多次调用Mysql存储过程报错解决办法

PHP多次调用Mysql数据库的存储过程会出现问题,主要问题为存储过程中执行多次SQL语句不能一一释放导致的,网上找了一些解决办法,比如使用 multi_query 然后一个一个释放,但是发现根本不适合我们的项目,我们使用CI框架写的,更多的是使用CI的数据库处理方法.所以只能另辟蹊径. 一次偶然,把Mysql链接方式改成了mysqli,两种不同的PHP连接mysql的扩展,官方在高版本中推荐使用mysqli,结果却奇迹般好了,使用Mysql长连接也行,天意么? PHP多次调用Mysql存储过程

报错解决方法Error: Can't connect to local MySQL server through socket

Error: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)Errno.: 2002解决方法一:因为你还没有启动mysql,当你启动mysql后,mysql.sock就会自动的生成../bin/safe_mysqld   --user=root   &(这是默认的).如果还没有,就是MYSQL权限没给,或其它原因还有就是 你的mysql是否启动了      启动后一般很难出现这个

mysql 更新sql报错:You can't specify target table 'wms_cabinet_form' for update in FROM clause

数据库里面有两个字段的位置不对,要把他们对调换下.因为没有数据库写的权限,需要用sql语句来实现.原来以为简单的 update table a set a.字段a=(select b字段 from table  where id=?) ,set a.字段b=(select a字段 from table where id=?) where id=? ,结果报了 这个问题 You can't specify target table 'wms_cabinet_form' for update in

mysql报错解决MySQL Binlog(异常)——mysqlbinlog: unknown variable 'default-character-set=utf8'

在使用mysqlbinlog分析日志时,报错: /usr/local/mysql/bin/mysqlbinlog: unknown variable 'default-character-set=utf8' 原因分析: 产生这个问题的原因是因为我在my.cnf中的client选项组中添加了:  default-character-set=utf8 这个是mysqlbinlog的一个bug 解决方法: 使用mysqlbinlog工具查看二进制日志时会重新读取的mysql的配置文件my.cnf,而不

关于mysql登录出现报错信息:ERROR 1045 (28000)的解决方法

登录mysql数据库出现报错信息ERROR 1045(28000)如下: [[email protected] ~]# mysql -uroot -p fanshine Enter password:  ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 分析:数据库存在空用户所致 解决: 停止mysql服务 [[email protected] ~]# service mysql