首页 > 其他 > 详细

You can't specify target table 'table' for update in FROM clause

时间:2018-05-26 17:06:38      阅读:419      评论:0      收藏:0      [点我收藏+]
delete from table1 where 
ID not in(select max(ID) ID from table1 group by row1) and 
row1 in (select row1from table1 group by row1 having count(*) > 1)
# 出现错误
#    You cant specify target table t_zqqk_stockinfo_copy2 for update in FROM clause

  不能从子句中指定目标表“TY-ZQQKYStknfOfCopy2”用于更新

 

delete from table1 where 
ID not in(select ID from (select max(ID) ID from table1 group by row1) as t1) and 
row1 in (select row1 from(select row1 from table1 groupby row1 havingcount(*) >1)as t2 )

 

子查询前再加一个子查询即可

 

技术分享图片

 

You can't specify target table 'table' for update in FROM clause

原文:https://www.cnblogs.com/cralor/p/9093532.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!