Count the records per week

Hi guys,

Can someone please give the query syntax for counting the records of Field 1 per week (Field 2 with daily dates).
The week starts Monday.
Thank you
marian68Asked:
Who is Participating?
 
Dale FyeConnect With a Mentor Commented:
In Access, this might look like:

SELECT Year([Field2]) as TransYear, DatePart("ww", [Field2]) as TransWeek, Count(*) as WeekCount
FROM yourTable
GROUP BY Year([Field2]) as TransYear, DatePart("ww", [Field2]) as TransWeek
0
 
Jared_SConnect With a Mentor Commented:
select
datepart(year,field2) as [year],datepart(week,field2) as [week], count(field1) as [Count]
from table
group by datepart(week,field2),datepart(year,field2)
order by datepart(year,field2), datepart(week,field2)
0
 
Jared_SCommented:
The access syntax that fyed posted will work in MS SQL too... no need for my re-post.
0
 
marian68Author Commented:
Thank you guys,
Yes the first query worked.
Thank you both
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.