首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

分页查询 (用row_number() 跟开窗函数over()更方便)

2012-11-16 
分页查询 (用row_number() 和开窗函数over()更方便)查询MyStudents表中 第8页中的数据(每页3条记录)--(1)s

分页查询 (用row_number() 和开窗函数over()更方便)
查询MyStudents表中 第8页中的数据(每页3条记录)

--(1)

select * from
(
select *,
ROW_NUMBER()over(order by FId asc) as Rnumber
from MyStudents
)
as Tbl3
where Rnumber between (3*7+1) and 3*8


--(2)

select top 3 * from MyStudents
where FId not in
(select top (3*7) FId from MyStudents 
order by FId )
order by FId 


热点排行