sql server 2012使用新特性offset和fetch next完成分页操作

1

select *
     from HumanResources.Department
     where DepartmentID>1
order by DepartmentID
offset 2 rows
fetch next 5 rows only;

offset后面的数字表示指定在何处开始返回行,fetch 则表示返回多少行

posted @ 2017-09-14 17:47  白羽轻飘  阅读(746)  评论(0编辑  收藏  举报