sql server 排序 row_number() over(order by ) as row /

第一种排序方法:

利用row_number() over(order by createtime desc) as row

参考来源:

版权声明:本文为CSDN博主「云游的二狗」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/missingshirely/article/details/44037037

语法如下:

select * from (

    select *, ROW_NUMBER() OVER(Order by a.CreateTime DESC ) AS RowNumber from table_name as a
  ) as b
  where RowNumber BETWEEN 1 and 5

 

posted on 2023-11-07 14:16  张不胖  阅读(61)  评论(0编辑  收藏  举报

导航