您不能在FROM子句中为更新指定目标表'rinexo'

时间:2013-07-09 03:28:06

标签: mysql

此查询的输出为我提供了表中的重复行

select * from rinex1 where rid not in 
  (select min(rid) from rinex1 group by rinex_version,type);

现在我想使用此查询

删除它们
delete from rinex1 where rid not in 
  (select min(rid) from rinex1 group by rinex_version,type); 

它出现以下错误:

  

您无法在FROM子句

中为更新指定目标表'rinexo'

我该怎么办?

1 个答案:

答案 0 :(得分:0)

试,

DELETE FROM rinex1 
WHERE rid NOT IN 
    (SELECT MIN(rid) 
     FROM rinex1 
     GROUP BY rinex_version, type
    ) AS p ;