On my website (www.rogersaccesslibrary.com), is a small Access database
sample called "MaxQueryProblem.mdb" which should shed some light on this for
you.

Signature
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
> I have the following query:
>
[quoted text clipped - 13 lines]
>
> Any help is greatly appreciated.
joho00@gmail.com - 08 May 2006 21:08 GMT
Roger,
Based on your examples, I was able to get this working. Thank you very
much!
Oddly enough, I wasn't able to get the second example you provided
(subquery) to work. I think the double innerjoins were the root of the
problem but I'm not positive. I've included the resulting query below
for your reference.
SELECT tableBackup.BackupDate AS [Backup Date], tableBackup.Type,
tableTape.Serial, tableBackup.Status
FROM tableTape INNER JOIN (tableBackup INNER JOIN tableJoinBackupTape
ON tableBackup.ID = tableJoinBackupTape.BackupID) ON tableTape.ID =
tableJoinBackupTape.TapeID
WHERE (((tableBackup.BackupDate) In (SELECT Max(tableBackup.BackupDate)
AS BackupDate FROM tableTape INNER JOIN (tableBackup INNER JOIN
tableJoinBackupTape ON tableBackup.ID = tableJoinBackupTape.BackupID)
ON tableTape.ID = tableJoinBackupTape.TapeID GROUP BY
tableTape.Serial)));
It is returning 26 records when there should be only 22 (I only have 22
tapes). The duplicate records showed nothing unique that I could draw a
correlation from.
The first example you provided (2 seperate queries) worked as expected
though. I've included them below for reference as well.
First query (queryMaxOfBackupDate):
SELECT Max(tableBackup.BackupDate) AS BackupDate, tableTape.Serial
FROM tableTape INNER JOIN (tableBackup INNER JOIN tableJoinBackupTape
ON tableBackup.ID = tableJoinBackupTape.BackupID) ON tableTape.ID =
tableJoinBackupTape.TapeID
GROUP BY tableTape.Serial;
Second query:
SELECT queryMaxOfBackupDate.Serial, queryMaxOfBackupDate.BackupDate AS
[Backup Date], tableBackup.Type, tableBackup.Status
FROM queryMaxOfBackupDate INNER JOIN tableBackup ON
queryMaxOfBackupDate.BackupDate = tableBackup.BackupDate
ORDER BY queryMaxOfBackupDate.BackupDate DESC;
Thanks again for your help.
John