MS Access query - select most recent date

15,944
SELECT userid, Max(appointment) AS most_recent
FROM YourTable
GROUP BY userid;
Share:
15,944

Related videos on Youtube

Sapvinder
Author by

Sapvinder

Updated on June 04, 2022

Comments

  • Sapvinder
    Sapvinder almost 2 years

    I have a query I'm designing which grabs data from multiple different tables. In MS Access 2010, how would I create one of the query columns so that it returns the most recent date out of a series of dates, for each user in the table:

    Sample data from table:

    userid: | appointment:
    000001  | 05/10/2009
    000001  | 05/10/2010
    000001  | 05/11/2010
    000002  | 05/12/2009
    000002  | 30/12/2010

    expected output for field query:

    userid:  | appointment:
    000001   | 05/11/2010
    000002   | 30/12/2010