Return dates within groups

  • Thread starter Thread starter ST123
  • Start date Start date
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?
 
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));
 
Back
Top