Sunday, October 26, 2014

Is it possible to nest SELECT statements?


Select * from (
SELECT *
,ROW_NUMBER() OVER(ORDER BY OrderID DESC ) RN40
,ROW_NUMBER() OVER(ORDER BY OrderID ASC ) RN20 FROM dbo.Orders) t
WHERE RN40<= 40 Or RN20<=20


No comments:

Post a Comment