with cte (usr, ordernum, amount) as (
select 1, 1, 10
union all
select 1, 2, 10
union all
select 1, 3, 10
union all
select 2, 3, 5
union all
select 2, 4, 15
union all
select 3, 5, 15
union all
select 4, 6, 10
union all
select 4, 7, 8
)
select TOP 1 WITH TIES *, dense_rank() over(partition by usr order by amount desc) rn
from cte c1
ORDER BY rn