SqlServer 2008R2 分页查询语句写法
发布时间:2020-12-12 13:44:18 所属栏目:MsSql教程 来源:网络整理
导读:SqlServer 2008R2分页新写法 --以前的写法-必须借助row_number()函数来获取行的序列号 Select * from ( select ROW_NUMBER() over( order by name asc ) as __tempId,* From ( select t.* from student t) as a ) as a Where a.__tempId between 1 And 10 --
--以前的写法-必须借助row_number()函数来获取行的序列号
Select * from ( select ROW_NUMBER() over(order by name asc) as __tempId,* From (select t.* from student t)as a )as a Where a.__tempId between 1 And 10 --现在的写法-用offset 与 fetch next 来处理 select t.* from student t order by t.name asc offset 0 rows fetch next 10 rows only
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |