When you use an aggregate function in a SELECT statement, you cannot specify
any fields you want they way you usually can in a SELECT statement. Only
fields that are part of the GROUP BY clause can be retrieved. How can I
create a join to select a record from a table using the MAX function and
then have use of all of the fields in that record? Anyone know?
This is something I have tried but it does not seem to work in Access:
SELECT t1.Column1, t1.Column2, t2.Column3, t2.Column4
FROM
(
SELECT Column1, MAX(Column2) AS Column2
FROM Table1
GROUP BY Column1
) t1
INNER JOIN Table1 t2
ON t1.Column1 = t2.Column1 AND t1.Column2 = t2.Column2
Thanks.
Robert