SQLServerで、何行目~何行目のデータを返す

11行目~20行目のサンプル

USE AdventureWorks2012;
GO

SELECT * FROM
(
  SELECT
    ROW_NUMBER() OVER(ORDER BY SalesYTD DESC) AS RN
  , FirstName
  , LastName
  , ROUND(SalesYTD, 2, 1) AS “Sales YTD”
  FROM Sales.vSalesPerson
  WHERE TerritoryName IS NOT NULL AND SalesYTD <> 0
) D
WHERE RN >= 11
 AND      RN <= 20

広告を非表示にする