I am a complete beginner. So please be patient.
I have one table that contains all the runners that are entered to run in one of several races on a given day. In another table I have their names and a rating of all their performances to date.
Table 1
Name - Race
John - 1
Joe - 1
Steve 1
Mike - 1
Cindy - 2
Jan - 2
Patty - 2
Pam - 2
Donna - 2
Table 2
Date - Name - Rating
Date - John - 88
Date - John - 91
Date - John - 94
Date - John - 92
Date - Joe - 76
Date - Joe - 79
Date - Joe - 78
Date - Joe - 75
Date - Joe - 80
Date - Joe - 79
Date - Steve - 95
Date - Steve - 94
Date - Mike - 91
Date- Mike - 90
Date - Mike - 91
Date - Mike - 89
I want the query to be able to look up each runner in Race 1 (using table 1), find their most recent race in table 2 (the first one in the list under that name), compare the ratings of all the runners in that race, and then tell me who ran fastest last time out.
In this case race #1 should return John 88, Joe 76, Steve 95, and Mike 91 and determine that Steve 95 is the best in race #1.
Then it should do the same thing for Race #2, race #3, race #4 etc.... and give me all the top rated runners for the day.
I might want to do a similar thing where I don't just look at the last race. I may want to average the last two, take the best of the last 2, do a weighted average of the last 3 etc..
Thanks