SELECT Format(AttendDate, "yyyy-mm") As Month,
CustomerID,
Min(AttendDate) As FirstDate,
Max(AttendDate) As LastDate
FROM TableName
GROUP BY Format(AttendDate, "yyyy-mm"), CustomerID
For a given month...
SELECT CustomerID,
Min(AttendDate) As FirstDate,
Max(AttendDate) As LastDate
FROM TableName
WHERE AttendDate BETWEEN #1/1/2005# AND #2/1/2005#
GROUP BY CustomerID
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.