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

challenging query..I need help

Status
Not open for further replies.

hello101

Instructor
Jun 26, 2006
18
US
Hi,

I'm trying to write a query that does the following:
First:Assume today is the 10th of january
get the total volume generated from the beginning of this month until today's date. Do the same for the previous three month and then get the business days and compare the volumes based on that. I already did all that.

Now the challenging part is: if there's 11 business days in this month and there was 10 days from the previous month. How can I compare the volume that I have until the 10th business days of this month witht the one from the previous month until the 10th business days.

Note: this should be automated. That means the query should work fine if I run it after 10 days.

any ideas....

Thank you
 
I don’t know the Structure of your data but for starters you will need a table listing all business days of the month
date businessday
1/1/7 0
1/2/7 1
1/3/7 2
1/4/7 3
1/5/7 4
1/6/7 0
1/7/7 0
1/8/7 5
.....

or at least a indicator if it is a business day


1/1/7 n
1/2/7 y
1/3/7 y
1/4/7 y
1/5/7 y
1/6/7 y
1/7/7 n
1/8/7 y
.....

And then you can join to this table where businessday <=10
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top