Query to Return Most Recent Date

Princecoxy

New member
Local time
Tomorrow, 00:29
Joined
May 29, 2022
Messages
1
Hello All, I seem to be stuck on this query. A Customer can have multiple Interaction dates and Next Appointments which can have multiple entries by Date. I am trying to query the most recent Date for each NextAppointment per Customer.

So, looking at the below sample I would want to return 13-Mar-22 for that particular Customer and 21-Jul-22 for Customer with identification number 1234. These rows contain the most recent Date per NextAppointment.

Any thoughts on how I can accomplish this? Thanks.
 

Attachments

  • Screenshot 2022-05-29 104948.jpg
    Screenshot 2022-05-29 104948.jpg
    42.6 KB · Views: 219
If there are multiple interaction types, you might need criteria to specify which type.

SELECT CustomerID, Max(InteractionDate) AS MDate FROM table GROUP BY CustomerID
Where CustomerID = Forms!myform!myCustomerID AND InteractionType = "NextAppointment";
 
Thanks for the correction. I wasn't paying attention.
 

Users who are viewing this thread

Back
Top Bottom