首页 > 其他 > 详细

分页查询

时间:2017-03-14 10:51:14      阅读:163      评论:0      收藏:0      [点我收藏+]

Student表如下图:

技术分享

分页查询方式一:

1 select top 3 * from Student
2 where StudentId not in
3 (
4 select top 3 StudentId from Student
5 order by StudentId
6 )
7 order by StudentId

执行结果:

技术分享

分页查询方式二:

1 select * from
2 (
3 select *, row_number() over(order by StudentId)as id from Student
4 )as tem 
5 where id between 2 and 6

执行结果:

技术分享

 

分页查询

原文:http://www.cnblogs.com/liutao1122/p/6547062.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!