Inner join query showing more than I want

coach.32

Registered User.
Local time
Today, 16:21
Joined
Aug 14, 2011
Messages
28
I have two queries; the first is:
#SELECT Max(tblWinnersOnlyAllAges.P1) AS MaxFor, tblWinnersOnlyAllAges.Team, tblWinnersOnlyAllAges.Age
FROM tblWinnersOnlyAllAges
GROUP BY tblWinnersOnlyAllAges.Team, tblWinnersOnlyAllAges.Age
ORDER BY tblWinnersOnlyAllAges.Team, tblWinnersOnlyAllAges.Age;#
The results from this query are exactly what I want to start with.
eg: Berwick U10 162
Berwick U11 175
Berwick U12 180 etc. This is done for all Teams. After this query I need to show what is on the whole row of each of the Maximum records, so I ran the following query:
#SELECT tblWinnersOnlyAllAges.*, tblWinnersOnlyAllAges.Team, tblWinnersOnlyAllAges.Age, tblWinnersOnlyAllAges.P1
FROM tblWinnersOnlyAllAges INNER JOIN qryHSFAll ON tblWinnersOnlyAllAges.Team = qryHSFAll.Team
WHERE (((tblWinnersOnlyAllAges.P1)=[qryHSFAll]![MaxFor]));#
This almost works, except it show an odd record every now and then and I can't understand why. eg: Berwick 26 10 162 U10 1988 is the Maximum value for that Team in that Age but the results may also show Berwick 22 12 144 U10 1991. Could anyone please shed some understanding on what I am doing wrong with my second query. Thank-you for taking the time to look at this long winded post.
 
Your SQL is all over the place. Show us some sample data (perhaps in a spreadsheet) and also show what you would like to achieve.
 

Users who are viewing this thread

Back
Top Bottom