Share via

MSAccess - Help on query

Anonymous
2025-04-23T09:52:35+00:00

Dear All,

I need to write a query for MSAccess which gives the record having the most recent activation date as in the second table below:

From here you can download the MSAccess database

Thanks

Microsoft 365 and Office | Access | Other | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

6 answers

Sort by: Most helpful
  1. HansV 462.6K Reputation points MVP Volunteer Moderator
    2025-04-23T11:22:30+00:00

    Like this:

    SELECT Table.* FROM [Table]WHERE Table.Activated_Date=(SELECT Max(T.Activated_Date) FROM [Table] AS T WHERE T.Serialnumber=Table.SerialNumber)

    2 people found this answer helpful.
    0 comments No comments
  2. Duane Hookom 26,820 Reputation points Volunteer Moderator
    2025-04-23T22:56:37+00:00

    That’s what I figured. Sometimes solving the technical aspects is easier than getting a solid specification.

    0 comments No comments
  3. ScottGem 68,810 Reputation points Volunteer Moderator
    2025-04-23T21:22:14+00:00

    I considered that but since the OP said; "the record having the most recent activation date" I answered that way.

    0 comments No comments
  4. Duane Hookom 26,820 Reputation points Volunteer Moderator
    2025-04-23T16:23:39+00:00

    Scott,

    Your query will return only a single record rather than a record for each Serialnumber which the OP didn't mention in his post but was apparent in the images. It was a key specification that was somewhat overlooked by the OP.

    0 comments No comments
  5. ScottGem 68,810 Reputation points Volunteer Moderator
    2025-04-23T11:38:04+00:00

    SELECT TOP 1 table.* FROM table

    ORDER BY Activated_Date DESC;

    0 comments No comments