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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Weekly Query Help

Status
Not open for further replies.

123anthony

Technical User
Jul 18, 2007
4
GB
Hi I need to group some dates from a table so that in my query, it groups weeks. How would I do this? Thanks.
 


Hi,

A method I use...
[tt]
WkOf: INT(({TheDateField]-2)/7)*7)
[/tt]
returns previous the Saturday for any given date. Add 2 and it returns a Monday.

Skip,

[glasses] To be safe on the [red]FOURTH[/red],
Don't take a [red]FIFTH[/red] on the [red]THIRD[/red]
Or you might not come [red]FORTH[/red] on the [red]FIFTH[/red]
[red][highlight blue]FORTH[/highlight][/red][white][highlight red]WITH[/highlight][/white] [tongue]
 
You may group by Format([date field], "ww")

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Well I tried both, the first I can't get to format right and the second just displays the week number relevant to the year. Im still a bit stuck, can anyone help?
 
So, which result do you want with which input data, and what have you tried so far ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Well what I have in my table are loads of different dates. In my query, I want these to be grouped in weeks with it showing the week commencing. Thanks.
 
So, you want to group by this ?
StartOfWeek: [Date field]-Weekday([Date field],2)+1

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top