• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 215
  • Last Modified:

Compare Dates Weekly Starting From Monday Instead Of Sunday ?

I want to work out weekly stats on specific records for the year, what i want to achieve is the following:  -

I want to count a new week starting on a monday and ending on sunday

For each year start week 1 on the first monday of january

How do i go about setting this up ?

I have the following query but this counts from Sunday first

SELECT COUNT(*)
FROM Table
WHERE DATEPART(week, GETDATE()) = DATEPART(week, dateadded)


So the output would be for today 12/04/05: -

WEEK 15

Record count 3 etc..

Cheers

JT
0
jturkington
Asked:
jturkington
  • 2
1 Solution
 
mrichmonCommented:
well all you have to do is add 1 to the date then right?
0
 
jturkingtonAuthor Commented:
of course ..........., sorry for the silly question

JT
0
 
mrichmonCommented:
no problem.

I can't tell you how many times I have missed the obvious answer thinking it must be more complex.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now