Query date by week

H

HMS2003

I am using Access 2000 and I have a database containing a number of dates in the form of mm/dd/yy. How can I run a query that would separate these dates by the week? I also want to run queries that will separate them by month and by year.
 
M

Michel Walsh

Hi,


Make a Total (Group By) query. In a free column, type

Date[Part("ww", YourDateTImeFieldnameHere)

and in the Total line, keep the proposed GroupBy. The SQL statement would be
something like

SELECT ... GROUP BY DatePart("ww", YourDateTimeFieldNameHere)


Sure, you can COUNT or SUM other fields, and the aggregation will be then
"by week". If you have to span year, add the appropriate group:



SELECT ... GROUP BY Year(YourDateTimeFieldNameHere), DatePart("ww",
YourDateTimeFieldNameHere)



Hoping it may help,
Vanderghast, Access MVP

HMS2003 said:
I am using Access 2000 and I have a database containing a number of dates
in the form of mm/dd/yy. How can I run a query that would separate these
dates by the week? I also want to run queries that will separate them by
month and by year.
 

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

Similar Threads


Top