473,385 Members | 1,829 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

obtaining and then grouping by week no's

I have a query that returns [TheDate],[Number of Bookings] and [The Day] :

12/05/04 3 Wednesday
13/05/04 0 Thursday
and so on

what I would like to do now is count the number of bookings by week so from
monday to friday from the first date get the sum of bookings.

How do I distinguish between the different weeks without any type of week
number?

Does a function exist that will allow me to get the week numbers between
dates and then that way I can create a new query to group by week number and
then count the sum of the bookings.

I did a few searches but havnt bee able to find any functions that go beyond
basic date calculations.

Regards in advance

Peter
Nov 13 '05 #1
5 3016
Peter Bailey wrote:
I have a query that returns [TheDate],[Number of Bookings] and [The Day] :

12/05/04 3 Wednesday
13/05/04 0 Thursday
and so on

what I would like to do now is count the number of bookings by week so from
monday to friday from the first date get the sum of bookings.

How do I distinguish between the different weeks without any type of week
number?

Does a function exist that will allow me to get the week numbers between
dates and then that way I can create a new query to group by week number and
then count the sum of the bookings.

I did a few searches but havnt bee able to find any functions that go beyond
basic date calculations.

Regards in advance

Peter

Format(Date, "ww")
--

\\\\\\
\\ \\ Windows is searching
\ \ For your sig.
\ \ Please Wait.
\__\

Nov 13 '05 #2
"Peter Bailey" <pe*********@andaluz.fsbusiness.co.uk> wrote in message news:<cg**********@newsg3.svr.pol.co.uk>...
I have a query that returns [TheDate],[Number of Bookings] and [The Day] :

12/05/04 3 Wednesday
13/05/04 0 Thursday
and so on

what I would like to do now is count the number of bookings by week so from
monday to friday from the first date get the sum of bookings.

How do I distinguish between the different weeks without any type of week
number?

Does a function exist that will allow me to get the week numbers between
dates and then that way I can create a new query to group by week number and
then count the sum of the bookings.

I did a few searches but havnt bee able to find any functions that go beyond
basic date calculations.

Regards in advance

Peter

================================================== ========================
Hi!
I'm not sure if this can help you, but this query:

SELECT
tblOrders.InvoiceID,
DatePart("yyyy",[MyDate],1,0) AS MyYeaR,
tblOrders.MyDate,
tblCust.Custnr,
tblKunder.FirstName,
Format(Sum([Price]*[Amount]),"Standard") AS Sales

FROM
(tblCust INNER JOIN tblOrders ON tblCust.CustID = tblOrders.CustID)
INNER JOIN
tblOrderDetails ON tblOrders.InvoiceID = tblOrderDetails.InvoiceID

GROUP BY
tblOrders.InvoiceID,
DatePart("yyyy",[MyDate],1,0),
tblOrders.MyDate,
tblCust.Custnr,
tblCust.Name

HAVING
(((DatePart("yyyy",[MyDate],1,0))=[TELL ME WHAT YEAR]))

ORDER BY
tblOrders.MyDate DESC;

produces the nicest report I've ever made.
The report is then having an unbound textbox in the toptext for MyDate:
=Format$([MyDate];"mmmm" & " yy";0;0)

and is being sorted:

MyDate DESCENDING;
Custnr ASCENDIND;

and the report will list all activity within each month, nicely output like:

AUGUST:

2004.05.01 Anka Paul 1250:- EUR
2004.05.06 Smith Gold 975:- EUR

and so on...

Hope this can help you!

Me.Name
Nov 13 '05 #3
"Peter Bailey" <pe*********@andaluz.fsbusiness.co.uk> wrote in message news:<cg**********@newsg3.svr.pol.co.uk>...
I have a query that returns [TheDate],[Number of Bookings] and [The Day] :

12/05/04 3 Wednesday
13/05/04 0 Thursday
and so on

what I would like to do now is count the number of bookings by week so from
monday to friday from the first date get the sum of bookings.

How do I distinguish between the different weeks without any type of week
number?
You don't. You create an expression to group on.
=Format$([SomeTime],"ww",0,0)
Does a function exist that will allow me to get the week numbers between
dates and then that way I can create a new query to group by week number and
then count the sum of the bookings.
?datediff("ww",#1/1/04#,date) <-- Today's Date.
33

So query 1 gets the differences in weeks, and then the second does the
grouping. Or you could do it in a report.
I did a few searches but havnt bee able to find any functions that go beyond
basic date calculations.

Regards in advance

Peter

Nov 13 '05 #4
I wanted something more like this :

I have a qry that returns the number of bookings on any particular day
excluding saturday and sundays.

[date] [Num_of Bookings] [Day of week]

04/04/04 10 Monday
05/04/04 5 Tuesday
06/04/04 6 Wednesday
07/04/04 0 Thursday
08/04/04 3 Friday

11/04/04 10 Monday
12/04/04 7 Tuesday
13/04/04 3 Wednesday
14/04/04 2 Thursday
15/04/04 1 Friday
What I would like is a 4th Column titled week number that will allow me to
attach the week number (it could be any number) so that I can group on week.
ie the first set of dates here 4th to the 8th would show lets say week 1 and
then the second set of dates 11th to 15th would show week 2. unless I can
extract the natural week number of that week during the year.

04/04/04 10 Monday 1
05/04/04 5 Tuesday 1
06/04/04 6 Wednesday 1
07/04/04 0 Thursday 1
08/04/04 3 Friday 1

11/04/04 10 Monday 2
12/04/04 7 Tuesday 2
13/04/04 3 Wednesday 2
14/04/04 2 Thursday 2
15/04/04 1 Friday 2

I would then be able to create a new query to get the sum of booking for
each week by grouping on the week number column.

Regards in advance and my apologies for not being so clear.
"Peter Bailey" <pe*********@andaluz.fsbusiness.co.uk> wrote in message
news:cg**********@newsg3.svr.pol.co.uk...
I have a query that returns [TheDate],[Number of Bookings] and [The Day] :

12/05/04 3 Wednesday
13/05/04 0 Thursday
and so on

what I would like to do now is count the number of bookings by week so from monday to friday from the first date get the sum of bookings.

How do I distinguish between the different weeks without any type of week
number?

Does a function exist that will allow me to get the week numbers between
dates and then that way I can create a new query to group by week number and then count the sum of the bookings.

I did a few searches but havnt bee able to find any functions that go beyond basic date calculations.

Regards in advance

Peter

Nov 13 '05 #5
That last post was fantastic my apologies for sending my post as the
datediff code worked a treat with a little tweaking.

Thank you so much for responding so quickly.

Regards
Peter
"Peter Bailey" <pe*********@andaluz.fsbusiness.co.uk> wrote in message
news:cg**********@newsg3.svr.pol.co.uk...
I have a query that returns [TheDate],[Number of Bookings] and [The Day] :

12/05/04 3 Wednesday
13/05/04 0 Thursday
and so on

what I would like to do now is count the number of bookings by week so from monday to friday from the first date get the sum of bookings.

How do I distinguish between the different weeks without any type of week
number?

Does a function exist that will allow me to get the week numbers between
dates and then that way I can create a new query to group by week number and then count the sum of the bookings.

I did a few searches but havnt bee able to find any functions that go beyond basic date calculations.

Regards in advance

Peter

Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Alicia | last post by:
Hi, I am trying to group by week and do a count of my data in between the dates. In Microsoft Access. Something similar to Before: Date Count --------- ---------...
3
by: ahaque38 | last post by:
Hello. Using A2K SP3, I am having the following problem with a report using "Sorting and Grouping". I have recently added a grouping in the reports for "Category2<>'CONTRACTS'". I have...
3
by: Bob | last post by:
I wish to group data on a report by week, month and year. Crystal reports has this ability as a built in function. Is there a quick way to do this in Access97/2000 VBA reports ? Thank you in...
11
by: Karl O. Pinc | last post by:
Hi, What's the best way to obtain the Julian day from a postgresql date? PostgreSQL 7.3.4 on i386-redhat-linux-gnu, compiled by GCC i386-redhat-linux-gcc (GCC) 3.2.2 20030222 (Red Hat Linux...
5
by: Hemant Shah | last post by:
Folks, We have table that cointains timesheet entries for the employees. Given user name, start date, and end date I want to get sum of hours for each project, for each week. Exmaple: Table...
7
by: derekdeben | last post by:
Hi, I have created a report that totals the number of days it took a product to ship by percentage by a date range for a specific location. My data comes from a query with the following headers: ...
2
by: egrill | last post by:
I need to be able to group date field by week. I can identify the week but I need to translate the ww into a date. For example; if the date falls in the 5th week of the year, I want to group all...
4
by: ElTipo | last post by:
Hello People, As I can obtain data with a dated fixed criteria. Without utilizing a parameter. Example: My field is . I need a criteria that indicate me a range date on Tuesday of the...
6
patjones
by: patjones | last post by:
Good afternoon: This seems like it shouldn't be hard, and then again this is how so many problems seem at the outset. My situation is this: I have a report called rptMain319, which is based...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.