how do i find a record by the most recent date

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I work for a Tech Services Company and I am trying to produce a report that
highlights when an engineer hasn't visited an outlet for a specific amount of
time. They will summit multiple records giving me "Outlet" & "Date of
Visit". I wish to be able to produce a report listing all Outlets and the
length of time it has been since the Last Visit. How do I do it?
 
Use a totals or aggregate query to get the last visited date

SELECT [Outlet], Max([Date of Visit]) as LastVisit
FROM [YourTable]
GROUP BY [Outlet]
HAVING Max([Date of Visit]) <= #2004/01/30#

That will return all Outlet that were last visited on or before Jan 30, 2004

SELECT [Outlet], Max([Date of Visit]) as LastVisit
FROM [YourTable]
GROUP BY [Outlet]
HAVING Max([Date of Visit]) <= DateAdd("yyyy",-1,Date())

That will return all Outlet that were last visited over a year ago from the
current system date.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top