Return dates within groups

S

ST123

I have a table containing a long list of dates. Each date represnets a visit
to a particular job. Each date also represents a payment. I could have the
following visits in a month, say 1st April 2009, 14th April 2009, 15th April
2009, and 24th April 2009. These set of dates would only equate to 3
payments as the visits on the 14th and 15th are actually one visit over 2
days. Can I return MAX Dates within groups or dates +or- 5 days?
 
K

KARL DEWEY

Try this, substituting your table and field names --
Adjacent_Dates ---
SELECT ST123.VisitDate
FROM ST123, ST123 AS ST123_1
WHERE (((DateDiff("d",[ST123].[VisitDate],[ST123_1].[VisitDate])) Between 1
And 3));

SELECT ST123.VisitDate
FROM ST123 LEFT JOIN Adjacent_Dates ON ST123.VisitDate =
Adjacent_Dates.VisitDate
WHERE (((Adjacent_Dates.VisitDate) Is Null));
 

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

Top