Hello, this problem I would within stored procedure using intermediate table.
For example:
declare @t table(MyID int identity(1,1),
CategoryID int,
CategoryName varchar(50)
)
declare @top int
set @top = 2
insert @t
select CategoryID, CategoryName
from Categories
order by CategoryName DESC
select...