设为首页 加入收藏

TOP

分页查询(用row_number()和开窗函数over()更方便)
2014-11-24 00:59:41 来源: 作者: 【 】 浏览:7
Tags:查询 row_number 开窗 函数 over 方便

分页查询(用row_number()和开窗函数over()更方便)
查询MyStudents表中第8页中的数据(每页3条记录)
www.2cto.com
--(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
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇MySQL的安装(详细图解) 下一篇数据分页时每页首条记录索引如何..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: