使用rowid[TEST1@orcl#02-12月-10] SQL>select * from t6; ID NAME ---------- -------------------- 1 zhangsan 1 zhangsan 2 lisi找出重复记录 [TEST1@orcl#02-12月-10] SQL>select id,name from t6 a where a.rowid<>(select max(rowid) from t6 b where a.id=b.id and a.name=b.name) 2 ; ID NAME ---------- -------------------- 1 zhangsan 现在就删除id,name相符的记录[TEST1@orcl#02-12月-10] SQL>delete from t6 where (id,name) in ( 2 select id,name from t6 a where a.rowid<>(select max(rowid) from t6 b where a.id=b.id and a.name=b.name));已删除2行。[TEST1@orcl#02-12月-10] SQL>commit;提交完成。[TEST1@orcl#02-12月-10] SQL>select * from t6; ID NAME ---------- -------------------- 2 lisi
---------- --------------------
1 zhangsan
1 zhangsan
2 lisi找出重复记录
[TEST1@orcl#02-12月-10] SQL>select id,name from t6 a where a.rowid<>(select max(rowid) from t6 b where a.id=b.id and a.name=b.name)
2 ; ID NAME
---------- --------------------
1 zhangsan
现在就删除id,name相符的记录[TEST1@orcl#02-12月-10] SQL>delete from t6 where (id,name) in (
2 select id,name from t6 a where a.rowid<>(select max(rowid) from t6 b where a.id=b.id and a.name=b.name));已删除2行。[TEST1@orcl#02-12月-10] SQL>commit;提交完成。[TEST1@orcl#02-12月-10] SQL>select * from t6; ID NAME
---------- --------------------
2 lisi