使用row_number()分页:
select * from (select row_number() over(order by 时间字段) 编号列,* from 表) as 别名
where 编号列>= pageSize*(pageCode-1) + 1 and 编号列<=pageCode*pageSize
说明:pageSize代表每页显示的数据行数,pageCode代表当前页的页码(从1开始)
举例:多表关联分页
select * from (select ROW_NUMBER() over(order by m.CreDate)as number,m.Account,m.Name,m.Sex, m.Tel
from Members m inner join Users u on m.CoachKey=u.[Key] or m.SalesKey=u.[Key] and u.DataState=1 where u.[Key]='6FCDD895-AEDB-464F-93E8-A79B013A23B5')as number
where number>=10*(1-1)+1 and number<=1*10
注意:多表分页必须把你要查的字段列出来,不能用*代替