,ROW_NUMBER() over用法总结
select *,ROW_NUMBER() over(partition by paadmrowid order by OperateDate) as group_idx from His_AdmFirstPage where OperateDate between '2017-01-01' and '2017-01-31'
按照paadmrowid字段进行分区,然后按照OperateDate进行排序
select s.* from (select *,ROW_NUMBER() over(partition by paadmrowid order by OperateDate) as group_idx from His_AdmFirstPage where OperateDate between '2017-01-01' and '2017-01-31') s
where s.group_idx=1