I have a database that collates the scores from our local Aussie Rules football league. I needed to obtain the maximum score kicked for each particular Round. I was given advise to have two select queries as below:
Code:
SELECT Max(AusFootBall.P) AS MaxOfP, AusFootBall.Rd
FROM AusFootBall
GROUP BY AusFootBall.Rd;
And then run the second query:
Code:
SELECT AusFootBall.*
FROM AusFootBall INNER JOIN QueryAus1_GetMaxByRd
ON AusFootBall.Rd = QueryAus1_GetMaxByRd.Rd
WHERE (((AusFootBall.P)=[QueryAus1_GetMaxByRd]![MaxOfP]));
I need to see the whole row that the Maximum score applies to, hence the second query.
This worked exceptionally well except on the odd occasion I would receive data like the following:
Rd Dn Team G B P Team2 Year
1 1 Berwick 15 10 100 Noble Park 1998
1 1 Souths 5 7 37 Wests 1981
1 2 Hallam 12 19 81 Geelong 2010
1 3 Cobram 5 7 37 St.Kilda 2001
I found that if the highest score in Division 3 was 37 for example, then the result for Division 1 would show it's highest score and also a random score that matched the 37 from Division 3. Is there anyway to get rid of the unwanted score(s). It happened for more than one round. Thank you in advance.