Skip to content
Advertisement

Selecting and ordering by the top from each country

I am scoring events where there are 2 individuals from each country in an event, BUT only the top finisher from a country receives points. If a country finishes 1st and 2nd, the 2nd place is dropped and the third place country moves up to 2nd place. Data:

I’ve tried using a couple of things like: ROW_NUMBER() OVER(PARTITION BY

I know this is wrong and I’m not getting only the top athletes from each country.

Advertisement

Answer

I believe you need to partition by the event ID as well. Something like:

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement