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

Complicated Date Query

Status
Not open for further replies.

michaela18

Technical User
Sep 9, 2009
37
US
I have the following query:

WHERE date1= '20100210'
-- and date2 <= '20100212'

Okay this is complicated, hard to explain.

This is something i run every day, mon-fri.
I want date1 to be 4 business days prior to today's date. So today is 03/01/2010 then date1 should be 02/23/2010. Tomorrow is 3/2, then date 1 should be 2/24.

date2 should be disregarded if date1 lands on tuesday-friday but if it lands on a monday, say if i was running the query on 3/5, then date1=3/1, so if it lands on a monday, then date2 <= the previous friday which is 2/26.

 
4 business days

Does your business have holidays?

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 



Use logic like...

if DAY([YourDate])="Fri" then 4 else 6


Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top