You could probably get by with something like this, assuming your table is called ratings
:
select r.*
from ratings r
inner join (
select name, rating, max(value) value
from ratings
group by name, rating
having count(distinct sport) > 1
) q
on r.name = q.name and r.rating = q.rating and r.value = q.value
There are certain situations where this may not produce what you want – ie if someone has the same value for different sports with the same rating. But it fits your use case above at the least.
3
solved How to select row with same value