J. Doe
J. Doe

Reputation: 13

SQL Select Query Highest Value

I have a table named Game:

  Player     Score
    1         100
    2         250
    2         300
    3         150
    4         700
    5         400
    5         500
    6         800

I need a query to return the highest score for each Player:

    1 - 100
    2 - 300
    3 - 150
    4 - 700
    5 - 500
    6 - 800

So far I have this

    SELECT Player, Score FROM Game

It returns everything but I just need what I explained above.

Upvotes: 1

Views: 39

Answers (1)

Vamsi Prabhala
Vamsi Prabhala

Reputation: 49270

You just need a group by on player.

SELECT Player, max(Score) as maxscore 
FROM Game
group by player

Upvotes: 4

Related Questions