0
SELECT short_name, overall, club_name, nationality_name FROM FIFA.dbo.players_22 

K. Mbappé  91  Paris Saint-Germain France
M. Neuer    90  FC Bayern München  Germany
M. ter Stegen   90  FC Barcelona    Germany
H. Kane 90  Tottenham Hotspur   England
N. Kanté   90  Chelsea France
K. Benzema  89  Real Madrid CF  France

The goal is to only return the highest overall players from each country. So I need to make the nationality_name column distinct, then take the MAX(overall). The output should look like this.

K. Mbappé  91  Paris Saint-Germain France
M. Neuer    90  FC Bayern München  Germany
H. Kane     90  Tottenham Hotspur   England

Also is there a way to easily change the foreign letters in the short_name column? It appears that my output is not recognizing accents on letters.

JoeMama786
  • 43
  • 5
  • "Making a column distinct" doesn't say which of the "duplicated" rows should be fetched. How do you know M. Neuer should be selected, not M. ter Stegen? Who should be selected if let's say T. Kroos from Germany also appears having an overall of 90? – Jonas Metzler Dec 10 '22 at 22:30
  • Good point, I did not think of that! In that case, I would like to return all of the players who are tied. So all 3 I would like to return. – JoeMama786 Dec 10 '22 at 22:35

0 Answers0