[AccessD] Need most recent record from many

Susan Jones susanj at sgmeet.com
Fri Mar 28 15:21:26 CST 2003


Hi Gustav,
Getting closer...This returns the information, but only for the most recent 
record, not for each member.  So, I think I need to add grouping.  Doing 
that I've been able to pull the right record for each member in one query, 
but then I have to link it back to the main table using two fields as 
secondary keys to pull the primary key in order to continue pulling 
information which seems circular and not good programming.
Susan


At 12:27 PM 3/28/03, you wrote:
>Hi Susan
>
>As always, it's easy when you know how ...
>Here is one method:
>
><SQL>
>
>SELECT
>   tblMember.*,
>   (SELECT TOP 1
>     datReceived
>   FROM
>     tblPayment
>   WHERE
>     (tblMember.ID = tblPayment.MemberID)
>   ORDER BY
>     datReceived DESC;) AS LastPayment
>FROM
>   tblMember;
>
></SQL>
>
>/gustav



More information about the AccessD mailing list