I would need an help for a task I should implement. I have a table, in which are included following fields:
- Username
- Score
- Competition
Each username can be present in the table several times, thus he can have several scores. In any case, a username can be associated to only one country.
Here below an example of my table:
Username !! Country || Score
Bob ! Italy ! 100
Bob ! Italy ! 150
Christian ! Italy ! 500
Christian ! Italy ! 200
Fred | Germany | 80
Carl | Germany | 700
Charlie | France | 400
Charlie | France | 280
Jean | France | 90
What I would get is a MYSQL command to get the ranking of each user in his country, considering only his best score and discarding the others.
Therefore, my ideal output should look like:
Christian ranked #1 in Italy
Bob ranked #2 in Italy
Carl ranked #1 in Germany
Fred ranked #2 in Germany
Charlie ranked #1 in France
Jean ranked #2 in France
I can order the users and have their rank, but having all the entries. What I would like to have is the ranking with just the best scores.
Any help is much appreciated,
Thanks a lot