码迷,mamicode.com
首页 > 其他好文 > 详细

不允许在子查询的同时删除原表数据(ERROR 1093 (HY000))

时间:2015-06-21 23:56:08      阅读:258      评论:0      收藏:0      [点我收藏+]

标签:mysql

delete from t where userid in (select userid from t where userid < 10);

ERROR 1093 (HY000): You can‘t specify target table ‘t‘ for update in FROM clause


delete from t where userid in (select userid from (select userid from t where userid < 10) tmp );

Query OK, 2 rows affected (0.02 sec)




本文出自 “dba天空” 博客,请务必保留此出处http://9425473.blog.51cto.com/9415473/1664022

不允许在子查询的同时删除原表数据(ERROR 1093 (HY000))

标签:mysql

原文地址:http://9425473.blog.51cto.com/9415473/1664022

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!