---
title: "SqlServer分页方案"
author: "michael1990"
date: "2014-08-31T01:00:41Z"
tags: []
categories: ["数据库"]
slug: "sqlserver"
draft: false
lastmod: "2014-08-31T01:00:41Z"
id: 2111173
url: "https://michael1990.iteye.com/blog/2111173"
---

SELECT TOP 10 * FROM TestTable  
WHERE (ID NOT IN (SELECT TOP 20 id FROM TestTable ORDER BY id))  
ORDER BY ID

SELECT TOP 页大小 * FROM TestTable  
WHERE (ID NOT IN (SELECT TOP 页大小\*页数 id FROM 表 ORDER BY id))  
ORDER BY ID