How to count dates inbetween a certain amount of weeks

C

Crisyina

I need to get a count of dates that are between a certain amount of time.
For example, i have a column that lists dates that were entered. I need to
find a way to count the number of dates that are in a week and display it. I
would need the program to group the count of dates entered per week. Is this
at all possible?
 
K

KARL DEWEY

Yes. How do you want the week group indicator to display? 2006 6 fot the
6th week of 2006 OR 6 FEB 06?
Post your SQL for the select query fields.
 
J

Jerry Whittle

SELECT DatePart("YYYY",[LAST_ANALYZED],1,2) AS TheYear,
DatePart("ww",[LAST_ANALYZED],1,2) AS TheWeek, Count(ASIF.LAST_ANALYZED) AS
NumberOfTimes
FROM ASIF
GROUP BY DatePart("YYYY",[LAST_ANALYZED],1,2),
DatePart("ww",[LAST_ANALYZED],1,2)
HAVING (((DatePart("YYYY",[LAST_ANALYZED],1,2)) Is Not Null))
ORDER BY DatePart("YYYY",[LAST_ANALYZED],1,2),
DatePart("ww",[LAST_ANALYZED],1,2);

With DatePart you might need to tweak what exactly begins the first week of
the year and what day of the week starts the week.. The 1,2 constants let you
tune this.
 

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