您的位置:首页 > 数据库

分页查询的SQL语句

2013-12-19 11:37 190 查看
每页10个记录,查询出第2页的记录

如果不带查询条件:

select top 10 * from WorkRecord
where (Id not IN (select top (10 * 2) Id FROM WorkRecord))

如果带查询条件

select top 10 * from (select * FROM WorkRecord
where (CatchTime > '2013/11/18 0:00:00' and CatchTime < '2013/12/18 23:59:59')) tag
where (tag.Id not IN (select top (10 * 2) tag1.Id FROM (select * FROM WorkRecord
where (CatchTime > '2013/11/18 0:00:00' and CatchTime < '2013/12/18 23:59:59')) tag1))
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: