sqlserver 分区函数去重复排序

 sqlserver 分区函数去重复排序

--获取,FlowID去重复的,按时间排序的,前一行
select * from (
     select *,row_number() over( partition by FlowID order by ConfirmDate asc ) as Sequence
     from Trade 
     ) as T 
where  T.Sequence<=1

 

posted on 2022-10-31 17:38  Jankie1122  阅读(23)  评论(0编辑  收藏  举报