Monday, October 27, 2014

Is it possible to nest SELECT statements?


;with mycte as (SELECT *
,ROW_NUMBER() OVER(ORDER BY OrderID DESC ) RN40
FROM dbo.Orders)

select *
from mycte
WHERE RN40 >20 and RN40 <=40
Order by OrderID ASC


No comments:

Post a Comment