博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
分页查询的SQL语句
阅读量:4650 次
发布时间:2019-06-09

本文共 473 字,大约阅读时间需要 1 分钟。

每页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))

转载于:https://www.cnblogs.com/pdfw/p/3481829.html

你可能感兴趣的文章