troubleshooting Question

Top 5 Players with no duplicates

Avatar of Lee W, MVP
Lee W, MVPFlag for United States of America asked on
Microsoft SQL Server
5 Comments1 Solution356 ViewsLast Modified:
Greetings folks,

I'm looking for a query that I really don't know how to do... Take this data:
269      Ben
255      Ben
247      Michael
245      Jim
236      Ben
234      Michael
233      Michael
227      Lee
222      Tony
215      Michael
215      Jim
214      Ben
213      Ben
212      Michael
212      Tony
208      Michael
207      Ben
206      Michael
205      Tony
201      Ben

I'm currently using this SQL Statement that produces the above data:
SELECT TOP 20
      G.Score AS 'Score',
      P.FirstName AS 'Player'
FROM
      Games G
INNER JOIN
      Players P ON G.PlayerID = P.PlayerID
ORDER BY
      Score DESC

What I want is to get the top 5 scores, but never duplicating a name.  So the successful query will produce the following output:
269      Ben
247      Michael
245      Jim
227      Lee
222      Tony

Any suggestions?
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros