当前位置:首页 > 数据库 > Oracle

sql分组获取第一条记录(sql+oracle)

sql版本

select * from
(select t.CloseDate,t.ExpiryDate,t.DataTypeLookupID,
ROW_NUMBER() over(partition by CloseDate,ExpiryDate,DataTypeLookupID order by CloseDate,ExpiryDate,DataTypeLookupID)
as new_index
from dbo.IndexVolatilityMarketData t
) a where a.new_index=1

oracle版本

 

select * from (
select t.as_of_date,t.origination_date,t.maturity_date,
rank()over(partition by t.as_of_date,t.origination_date,t.maturity_date order by t.as_of_date,t.origination_date,t.maturity_date) mm from alm_agreement_deposit t)a
where a.mm=1;

sql分组获取第一条记录(sql+oracle)

标签:

本文系统来源:http://www.cnblogs.com/kexb/p/4617479.html


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!

相关教程推荐

其他课程推荐