oracle数据库中如果有些记录字段是重复的,需要将这些数据删除掉,如果要删除的两条记录无论删哪个都可以,可采用下面这个方法:
例如学生表student中,学生姓名name和学号stu_no是重复的就删除掉一条。
select * from student a,student b where a.name = b.name
and a.stu_no= b.stu_no and a.rowid < b.rowid
delete from student a where a.rowid<(
select max(rowid) from student b where a.name = b.name
and a.stu_no= b.stu_no)
参考http://blog.youkuaiyun.com/onebigday/article/details/5715973
例如学生表student中,学生姓名name和学号stu_no是重复的就删除掉一条。
select * from student a,student b where a.name = b.name
and a.stu_no= b.stu_no and a.rowid < b.rowid
delete from student a where a.rowid<(
select max(rowid) from student b where a.name = b.name
and a.stu_no= b.stu_no)
参考http://blog.youkuaiyun.com/onebigday/article/details/5715973