`
roc08
  • 浏览: 224272 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

oracle删除重复数据

阅读更多
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.csdn.net/onebigday/article/details/5715973
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics