This query:
;with OrderedOrders AS
(
select * , ROW_NUMBER() over(order by AlbumName) as 'RowNumber'
from dbo.CountryAlbums
where SubCategoryName = 'Rockabilly'
)
select *
from OrderedOrders
where RowNumber between 5 and 10
is well written and has the same meaning as:
SELECT *
FROM (
SELECT * , ROW_NUMBER() OVER(ORDER BY AlbumName) AS 'RowNumber'
FROM dbo.CountryAlbums
WHERE SubCategoryName = 'Rockabilly'
) AS T
WHERE RowNumber between 5 and 10
You should be more specific when you saying: "this or that is not working"!