首页 > 代码库 > sql 中如何取出指定行: Row_Number

sql 中如何取出指定行: Row_Number

原文:sql 中如何取出指定行: Row_Number

ROW_NUMBER (Transact-SQL)

 

USE AdventureWorks2008R2;
GO
WITH OrderedOrders AS
(
    SELECT SalesOrderID, OrderDate,
    ROW_NUMBER() OVER (ORDER BY OrderDate) AS ‘RowNumber‘
    FROM Sales.SalesOrderHeader
)
SELECT *
FROM OrderedOrders
WHERE RowNumber BETWEEN 50 AND 60;

sql 中如何取出指定行: Row_Number