码迷,mamicode.com
首页 > 其他好文 > 详细

,ROW_NUMBER() over用法总结

时间:2018-04-18 11:40:05      阅读:1559      评论:0      收藏:0      [点我收藏+]

标签:group   first   MF   and   ted   over   stp   number   rstp   

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

,ROW_NUMBER() over用法总结

标签:group   first   MF   and   ted   over   stp   number   rstp   

原文地址:https://www.cnblogs.com/liling1994/p/7804829.html

(1)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!