处理MySQL删除数据时Error Code: 1093. You can't specify target table '表名' for update in FROM clause
2011-12-29 14:41
756 查看
在执行:
delete from _Resume where Id in(
select A.Id from _Resume A
inner join _User B on A.UserId = B.UserIdwhere A.CreateTime < B.CreateTime):
【详细错误】: Error Code: 1093. You can't specify target table '_Resume' for update in FROM clause.
【错误原因】:在更新或删除目标表中数据的时候如果使用子查询,目标表不能在子查询的From语句中出现~
原程序改造为:
create table tmp as
select A.Id from _Resume A
inner join _User B on A.UserId = B.UserId
where A.CreateTime < B.CreateTime;
delete from _Resume where Id in( select Id from tmp);
方法二:或者将子查询中的表使用别名.
delete from _Resume where Id in(
select A.Id from _Resume A
inner join _User B on A.UserId = B.UserIdwhere A.CreateTime < B.CreateTime):
【详细错误】: Error Code: 1093. You can't specify target table '_Resume' for update in FROM clause.
【错误原因】:在更新或删除目标表中数据的时候如果使用子查询,目标表不能在子查询的From语句中出现~
原程序改造为:
create table tmp as
select A.Id from _Resume A
inner join _User B on A.UserId = B.UserId
where A.CreateTime < B.CreateTime;
delete from _Resume where Id in( select Id from tmp);
方法二:或者将子查询中的表使用别名.
相关文章推荐
- 【mysql 】sql删除重复记录 You can't specify target table '表名' for update in FROM clause
- MySQL中执行sql语句错误 Error Code: 1093. You can't specify target table 'car' for update in FROM clause
- MYSQL 1093 之You can't specify target table for update in FROM clause解决办法
- MySQL问题:You can't specify target table '表名' for update in FROM clause
- 解决MYSQL的You can't specify target table 'xxxxxxxxxx' for update in FROM clause
- MYSQL之You can't specify target table for update in FROM clause解决办法
- you can't specify target table for update in from clause Mysql 报错
- mysql中You can't specify target table for update in FROM clause错误
- mysql Error Code: 1093. You can't specify target table 'base_extend' for update in FROM clause 0.001
- mysql中You can't specify target table for update in FROM clause
- MYSQL 临时表 #1093 - You can't specify target table 'dealer_admin' for update in FROM clause
- MySQL [Err] 1093 - You can't specify target table 'test' for update in FROM clause
- MySQL报1093错误,MySQL can’t specify target table for update in FROM clause
- 关于mysql 5.7版本“报[Err] 1093 - You can't specify target table 'XXX' for update in FROM clause”错误的bug
- Mysql 错误 Code: 1093. You can't specify target table for update in FROM clause
- mysql中错误:1093-You can’t specify target table for update in FROM clause的解决方法
- mysql中错误:1093-You can’t specify target table for update in FROM clause的解决方法
- 【mysql 】sql删除重复记录 You can't specify target table '表名' for update in FROM clause
- 【MySQL】解决You can't specify target table 'user_cut_record_0413' for update in FROM clause
- [Err] 1093 - You can't specify target table 'table' for update in FROM clause处理