retrieving by latest date

trackmedic

Registered User.
Local time
Today, 21:54
Joined
Aug 20, 2001
Messages
115
Hello,

I have a query that retrieves data by the latest date for the entries made for the year 2012. I need to include for the year 2011 also.

Example. If I have 10 work sites and I visited each worksite in 2011 and only three worksites in 2012 I would like the query to show the last date of all visits. I should end up with seven dates in 2011 and three in 2012. Make sense?

As always, all help is greatly appreciated
 
Something like this

SELECT TSilver.sitename, Count(TSilver.VisitDate) AS CountofVisitDate, Max(TSilver.VisitDate) AS MaxOfVisitDate
FROM TSilver
WHERE (((TSilver.VisitDate) Between #1/1/2011# And #12/31/2012#))
GROUP BY TSilver.sitename
;
 

Users who are viewing this thread

Back
Top Bottom