分页

  • 业务

    页容量/当前页码/总记录数(输出参数)

  • 实现

    URL->test.aspx?page=1

  • SQL

    

SELECT OrderID,CustomerID
FROM (
    SELECT OrderID,CustomerID,ROW_NUMBER() OVER(ORDER BY OrderID) AS Number
    FROM dbo.Orders
) AS T
WHERE T.number BETWEEN 11 AND 20
---------------------------------------------------------------------------
WITH MyTable(OrderID,CustomerID,Number)
AS (
    SELECT OrderID,CustomerID,ROW_NUMBER() OVER(ORDER BY OrderID)
    FROM dbo.Orders
)
SELECT *
FROM MyTable 
WHERE Number BETWEEN 11 AND 20

 

posted @ 2016-11-21 11:25  平小宅  阅读(76)  评论(0编辑  收藏  举报