Select * from (SELECT * ,ROW_NUMBER() OVER(ORDER BY OrderID DESC ) RN40,ROW_NUMBER() OVER(ORDER BY OrderID ASC ) RN20 FROM dbo.Orders) tWHERE RN40<= 40 Or RN20<=20
No comments:
Post a Comment