您的位置:首页 > 运维架构

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

2016-03-11 13:56 267 查看

--跳过2条取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 4 and 6

 

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: