首页 > 代码库 > Oracle_语句
Oracle_语句
1、删除 数据库中 重复的记录
1)
select * into #temp from (
select KaiGuanDuan,RongLiangPercent,Hz,RongLiangValue,P,Q,row_number() over(partition by KaiGuanDuan,RongLiangPercent,Hz,RongLiangValue,P,Q order by getdate()) as rId from fuhe
) as a where rId=1
2)
delete from fuhe
3)
insert fuhe(KaiGuanDuan,RongLiangPercent,Hz,RongLiangValue,P,Q) select KaiGuanDuan,RongLiangPercent,Hz,RongLiangValue,P,Q from #temp
ZC: 完全一样的记录,没有 主键,各个列数据都一样,测试下来 是OK
Oracle删除 字段值完全相同的记录,直留一条:
delete from fuhe a where rowid > (select min(rowid) from fuhe b where a.KaiGuanDuan=b.KaiGuanDuan and a.RongLiangPercent=b.RongLiangPercent and a.hz=b.hz and a.P=b.P and a.Q=b.Q);
Z
Oracle_语句
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。