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

Inbetween Start and Enddate

Status
Not open for further replies.

Lotek02

Technical User
Apr 30, 2002
10
0
0
US
I have a Database in which we have a Start and a End Date the problem is that we need to search for people who may be off between those dates. for Exp.

If John had July 1 threw the 15th off and we did a search for every one who was off on July 12th, we don't see John because the only date we get are July 1st and 15th for John.

Any Ideas.
Thank you.
 
You could add a field to your table containing the status of each person. Then you could set this status to &quot;OnVacation&quot; or so, If StartDate of vacation <= Date() and EndDate >= Date().

Then you can filter for this status.

MakeItSo

Andreas Galambos
EDP / Technical Support Specialist
Bowne Global Solutions Wuppertal, Germany
(andreas.galambos@bowneglobal.de)
HP:
 
This is a little complicated but you need to test for three different conditions.

* John leaves between the two dates.
* John returns between the two dates.
* John leaves before the start and returns after the end date.

You probably need something like:
Code:
Select ... From ...
WHERE    (StartDate <= LeaveDate AND EndDate > LeaveDate)
      OR (StartDate <  ReturnDate AND EndDate <= ReturnDate)
      OR (StartDate >  LeaveDate AND EndDate < ReturnDate)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top