方法一:
在Oracle中,你可以使用DELETE
语句结合ROWID
和子查询来删除重复的记录。以下是一个示例:
DELETE FROM your_table
WHERE ROWID NOT IN (SELECT MAX(ROWID)FROM your_tableGROUP BY column1, column2, ... -- 列出用于判断重复的列
);
原数据:
示例:
DELETE FROM SJS.CGGL_FWZX_USC_WS_SPYJ_SSFW
WHERE ROWID NOT IN (SELECT MAX(ROWID)FROM SJS.CGGL_FWZX_USC_WS_SPYJ_SSFWGROUP BY ID -- 列出用于判断重复的列
);
COMMIT ;
结果:
方法二:
DELETE FROM your_table
WHERE id NOT IN (SELECT MIN(id)FROM your_tableGROUP BY A, B, C);