Last Date

J

Joss

I have a query with two tables joined together by id.
The first table houses names and addresses while the
second table has multiple comment entries based upon
date. I want only the latest comment entry to show on
the query. What is the best way to do this?
 
A

Allen Browne

It will make the query read-only, but you can leave the Comments table out
of the query, and then pick up the latest comment by typing a subquery into
the Field row.

Something like this:
( SELECT TOP 1 tblComment.CommentFieldName FROM tblComment
WHERE tblComment.ForeignID = tblMain.MainID
ORDER BY tblComment.CommentDate DESC, tblComment.CommentID )
 
Top