использование внешнего применения
with cte as
(
select 454 as product_id, 'C-10' as category, 10 as discount union all
select 357,'C-10',9 union all
select 64,'C-10',10 union all
select 294,'C-11',17 union all
select 449,'C-11',17 union all
select 471,'C-11',17 union all
select 89,'C-11', 12 union all
select 56,'C-11', 10
) select distinct p1.category,a.product_id,a.discount
from cte p1
outer apply ( select top 1 p2.*
from cte p2 where p1.category=p2.category
order by discount desc, product_id asc
) a
вывод
category product_id discount
C-10 64 10
C-11 294 17
демонстрационная ссылка