mysql> select * from t;
+----+
| id |
+----+
| 1 |
| 2 |
| 3 |
| 4 |
| 5 |
| 6 |
| 7 |
| 8 |
| 9 |
| 10 |
+----+
10 rows in set (0.00 sec)
mysql> delete from t where id in (select id from t where id < 5);
ERROR 1093 (HY000): You can't specify target table 't' for update in FROM clause
mysql>

这样删除将报错,更改SQL语句为

mysql> delete  from t where id in (select * from (select id from t where id < 5) tmp);
Query OK, 4 rows affected (0.00 sec)

以这样的形式即可删除。

再优化之,改为表连接模式:

mysql> delete t from t join (select id from t where id < 5) tmp on t.id=tmp.id;
Query OK, 4 rows affected (0.01 sec)

mysql error 1093 解决办法的更多相关文章

  1. 阿里云vps上mysql挂掉的解决办法

    阿里云vps上mysql挂掉的解决办法 4条回复 用阿里云的vps用作blog服务器,系统很稳定,已经100多天一直运行正常,大概从上个月开始发现blog的mysql会有时挂掉,会收到短信通知.之前没 ...

  2. 十五、mac 中登陆mysql忘记密码解决办法

    mac 中登陆mysql忘记密码解决办法 1.打开终端,输入命令:cd /usr/local/mysql/bin 2.mysql -uroot -p,用这条命令登陆时报错信息: 报错:Enter pa ...

  3. MySQL 1366错误解决办法

    MySQL 1366错误大致描述如下 SQL Error: 1366: Incorrect string value: "xE8xAFxA6xE7xBBx86-" for colu ...

  4. MYSQL ERROR:1130 解决

    MYSQL ERROR:1130 解决   ERROR 1130: Host '127.0.0.7' is not allowed to connect to this MySQL server 解决 ...

  5. Springboot(八):emoji表情保存到mysql出错的解决办法

    emoji表情保存到mysql出错的解决办法 今天,在前端的说明信息中输入emoji表情的时候,插入数据库会报错 百度了一下,是因为mysql数据库的字符编码集不正确,utf8无法存入表情字符,只能将 ...

  6. CentOS忘记mariadb/mysql root密码解决办法

    本文不再更新,可能存在内容过时的情况,实时更新请访问原地址:CentOS忘记mariadb/mysql root密码解决办法: 这里有两种方式实现修改mariadb root密码. mariadb版本 ...

  7. 架构师必备:MySQL主从延迟解决办法

    上一篇文章介绍了MySQL主从同步的原理和应用,本文总结了MySQL主从延迟的原因和解决办法.如果主从延迟过大,会影响到业务,应当采用合适的解决方案. MySQL主从延迟的表现 先insert或upd ...

  8. Spring Boot连接MySQL报错“Internal Server Error”的解决办法

    报错信息如下: {timestamp: "2018-06-14T03:48:23.436+0000", status: 500, error: "Internal Ser ...

  9. [MySQL] SQL_ERROR 1032解决办法

    一.缘由: 在主主同步的测试环境,由于业务侧没有遵循同一时间只写一个点的原则,造成A库上删除了一条数据,B库上在同时更新这条数据. 由于异步和网络延时,B的更新event先到达A端执行,造成A端找不到 ...

随机推荐

  1. 用python给图片添加半透明水印

    # coding:utf-8 from PIL import Image, ImageDraw, ImageFont def add_text_to_image(image, text): font ...

  2. Why I get “No connection associated with this command”?

  3. K-th Number POJ - 2104

    K-th Number POJ - 2104 You are working for Macrohard company in data structures department. After fa ...

  4. 笔记-算法-hash以及hashlib使用

    算法-hash和hash表以及hashlib使用 1.      简介 1.1.    hash Hash(散列/哈希),就是把任意长度的输入(预映射pre-image)通过散列算法变换成固定长度的输 ...

  5. C# Redis存Session Hash存对象

    1.新建一个控制台程序,并新建一个类“UserInfo” 2.从github下载redis的windows服务 https://github.com/ServiceStack/redis-window ...

  6. Fragment 和 Activity 之间通信

    在 Activity 中获取 Fragment 实例: FragmentManager 提供了一个类似于 findViewById 的方法,专门用于从布局文件中获取 Fragment 实例: //通过 ...

  7. 【Sudoku Solver】cpp

    题目: Write a program to solve a Sudoku puzzle by filling the empty cells. Empty cells are indicated b ...

  8. 简单实现nodejs爬虫工具

    约30行代码实现一个简单nodejs爬虫工具,定时抓取网页数据. 使用npm模块 request---简单http请求客户端.(轻量级) fs---nodejs文件模块.   index.js var ...

  9. ROM+VGA 图片显示

    内容 1.将一幅图片制成mif文件,初始化rom,图片像素为 120 * 60 2.驱动VGA,将图片显示在屏幕上 1.VGA 时序 下面是我的笔记截图,感觉更好理解. 2.640*480 60hz ...

  10. DWR搭建以及使用教程

    DWR搭建以及使用教程   DWR(Direct Web Remoting)是一个Ajax的开源框架,用于改善web页面与Java类交互的远程服务器端的交互体验,可以帮助开发人员开发包含AJAX技术的 ...