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

分页查询的两种方法(双top 双order 和 row_number() over ())

时间:2016-03-10 18:42:18      阅读:113      评论:0      收藏:0      [点我收藏+]

标签:

--跳过10条取2条 也叫分页
select top 2 * from student
where studentno not in (
select top 2 studentno from student order by studentno
)
order by studentno

--row_number ()over() 分页
select * from(
select *,ROW_NUMBER()over(order by studentno)as myid from student
) as temp
where myid between 4and 6

分页查询的两种方法(双top 双order 和 row_number() over ())

标签:

原文地址:http://www.cnblogs.com/myhome-1/p/5262948.html

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