本文主要是介绍初步认识下Oracel的ROW_NUMBER()Over(partition by order by ),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
-----删除重复数据
delete from cwgs.loan_buy_extendopr
where oprno in (select oprno
from (select d.oprno,
d.y_contno,
row_number() over(partition by y_contno order by y_contno) row_flag
from cwgs.loan_buy_extendopr d) t
where t.row_flag > 1)
-----分组并组内排序,取第一条
select t.userno, t.corpno, t.departno
from (select r.userno,
r.corpno,
r.departno,
row_number() over(partition by r.departno order by r.userno asc) rn
from fmsys.sys_userstation r
where 1=1) t
where t.rn = 1
这篇关于初步认识下Oracel的ROW_NUMBER()Over(partition by order by )的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!