Have both distinct and count
Not sure I understand, but I guess something like:

select u.name, count(*)
from users u
join order o
    on u.id = o.user
group by u.name
order by max(o.cost) desc


would do. Please include your query and if relevant, table definitions for future questions.