Oracle 9i 删除重复数据

查询数据库中的重复记录

//查询单列重复记录 SELECT COLUMN_1,COUNT(*) FROM TABLE_NAME GROUP BY COLUMN_1HAVING COUNT(*)>1

//查找两列重复记录 SELECT COLUMN_1,COLUMN_2,COUNT(*) FROM TABLE_NAME GROUP BY COLUMN_1,COLUMN_2 HAVING COUNT(*)>1

//查找重复记录的详细信息 SELECT * FROM TABLE_NAME WHERE COLUMN_1 IN (SELECT CITY_ID     FROM EQUIP_F_ELECT_RATIO     GROUP BY COLUMN_1     HAVING COUNT(*)>1)

delete 表名 where 字段1 in(SELECT 字段1 FROM 表名 GROUP BY 字段1 HAVING COUNT(*)>1); commit;  

今天的笔试题,很遗憾错了,少了HAVING COUNT(*)>1。

你可能感兴趣的:(oracle,F#)