;with mycte as (SELECT * ,ROW_NUMBER() OVER(ORDER BY OrderID DESC ) RN40FROM dbo.Orders) ,mycte1 as (select *,ROW_NUMBER() OVER(ORDER BY OrderID ASC ) RN20 from mycteWHERE RN40 <=40)Select * from mycte1WHERE RN20<=20
No comments:
Post a Comment