Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Week Query 1

Status
Not open for further replies.

pd06498

IS-IT--Management
Dec 10, 2003
36
0
0
AU
I've been experimenting with queries to return data on a weekly basis, using datepart and :First Full Week".

I now have results that show data entered on 1st to 4th Jan 04 as week 53, then following on to week 1.

What I was wondering is, what happens when I get to the end of the year and end up with 2 x week 1's and so on. How can I distringuish each week to a year, i.e. in above example, 31 Dec 2003 and 1 Jan 04 both in week 53 of 2003.

Hope I have exlained question clearly enough.
 
By week, do you mean from Monday to Sunday or what not? If so, then it should not matter if the week starts in one month or year and ends in the next.

If thats the case, I suggest using the weekday function.

somthing like

Week: [mydate]+1-Weekday([mydate])

For week 10/3/04 - 10/9/04 this will return 10/3/04

Basicly returns the Start of the week only regardless of date.

Hope that helps,
ChaZ



"When religion and politics ride in the same cart...the whirlwind follows."
Frank Herbert
 
Thanks ChaZ

Works like a charm.

Dave
 
Glad to help.

ChaZ

"When religion and politics ride in the same cart...the whirlwind follows."
Frank Herbert
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top