sql 分组根据每组内部排序后的每组连续唯一的顺序编号

select row_number() over (partition by 分组字段 order by 排序字段) as 序号,表现出的是组内连续不唯一的序号,

select * from (select row_number() over (order by  排序字段 desc) as rowid from table) as table where rowid between (@PageIndex-1)*@PageSize+1 and @PageIndex*@PageSize 分页查询,可用于中小数据排序,

原文地址:https://www.cnblogs.com/lwyu/p/4952265.html