首页 | 新闻 | 交流 | 问吧 | 文档 | 手册 | 下载 | 博客

sql 中如何取出指定行: Row_Number

作者:  时间: 2011-05-30

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;