[AccessD] Need most recent record from many

Gustav Brock gustav at cactus.dk
Fri Mar 28 12:27:27 CST 2003


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


> I hope this is so easy I'll be embarrassed I even asked, but...
> I have a query that links two tables with a one-to-many relationship.  My 
> problem is that I want to pull only the most current record on the many 
> side.  I know this has to be something easy, but I'm either blind to it or 
> just not able to figure out where to start looking.  I tried to access the 
> archives, but the link takes me to the mail options page.
> Thanks!
> Susan



More information about the AccessD mailing list