SQL 取表中第几行至第几行数据

第一种:

1 select top 6 * from
2 (
3 select top 14 * from stu order by id
4 ) as t
5 order by id desc

第二种(推荐):

1 with total as
2 (
3     select *,row_number() over(order by name) as rownum from stu
4 )
5 select * from total where rownum between 10 and 15

 

posted @ 2019-03-15 09:23  陈彦斌  阅读(2890)  评论(0编辑  收藏  举报