ORACLE 删除重复行,保留一条记录SQL

    DELETE FROM cux_temp t
     WHERE t.name_id IN (
      SELECT c.name_id
        FROM cux_temp c
       GROUP BY c.name_id HAVING COUNT(c.name_id) > 1)
     AND ROWID NOT IN (
       SELECT min(c.rowid) row_id
         FROM cux_temp c
        GROUP BY c.name_id HAVING COUNT(c.name_id) > 1);

 

posted on 2018-01-23 11:46  huak  阅读(225)  评论(0编辑  收藏  举报