[AccessD] Last Date Query

David McAfee davidmcafee at gmail.com
Thu Dec 22 11:17:27 CST 2011


SELECT tbl1.Pat, Last(tbl1.Date) AS LastDate, tbl1.Result
FROM tbl1
INNER JOIN (SELECT Max(tbl1.Date) AS MaxDate FROM tbl1) B
ON tbl1.Date = B.MaxDate
GROUP BY tbl1.Pat, tbl1.Result;


The only thing to warn you about Pedro is if you have more than one record
with the same last date.

For instance.

A1 01/01/11 6
B1 01/01/11 5


Also "Date" is a bad name for a field name as it is a reserved word.

HTH
David McAfee



More information about the AccessD mailing list