分頁查詢的SQL語句

每頁10個記錄,查詢出第2頁的記錄select

若是不帶查詢條件:im

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

若是帶查詢條件top

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)) co

相關文章
相關標籤/搜索