Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Top Scores 1

Status
Not open for further replies.

TrekBiker

Technical User
Nov 26, 2010
330
GB
A scores table looks like this, recording each player's score on a number of competition days.

CompDate, Player, Score

I'd like a query that picks just the winners on each date. So shows Date, winner (or ties) and winning score.

 
The simplest method is to first create a query of top scores by date:

qgrpTopScores
SQL:
SELECT CompDate, Max(Score) as MaxScore
FROM tblScores
GROUP BY CompDate;
Then create another query using the table and new query:

SQL:
SELECT S.*
FROM tblScores S INNER JOIN qgrpTopScores Q ON S.CompDate = Q.CompDate and S.Score = Q.MaxScore

This can also be done in a single query.

Duane
Hook'D on Access
MS Access MVP
 
Thanks Duane, as ever.

I substituted S and Q for my table and field names but then it did the job.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top