Oracle_语句
Posted DrMess
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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_语句的主要内容,如果未能解决你的问题,请参考以下文章