SQL分页查询多种写法
![](http://www.csframework.com/images/article-type3.gif)
WITH T AS
( SELECT *,ROW_NUMBER() OVER(ORDER BY CreateTime) AS rowNum FROM 资料表 ) SELECT * FROM T WHERE rowNum BETWEEN 11 AND 20
SELECT *,ROW_NUMBER() OVER(ORDER BY Code) AS rowNum INTO #a FROM 资料表
SELECT * FROM #a WHERE rowNum BETWEEN 11 AND 20
SELECT * FROM ( SELECT *, ROW_NUMBER() OVER (ORDER BY CreateTime DESC) AS 'SN' FROM 资料表
WHERE 1=1) temp WHERE SN BETWEEN 1 AND 10
版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
NewDoc C/S框架网