Nov 28, 2015 #1 TrekBiker Technical User Joined Nov 26, 2010 Messages 334 Location 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.
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.
Nov 28, 2015 1 #2 dhookom Programmer Joined Jun 24, 2003 Messages 22,561 Location US 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 Upvote 0 Downvote
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
Nov 30, 2015 Thread starter #3 TrekBiker Technical User Joined Nov 26, 2010 Messages 334 Location GB Thanks Duane, as ever. I substituted S and Q for my table and field names but then it did the job. Upvote 0 Downvote