Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Check that 2 dates are between 2 other dates
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00946137
Message ID:
00946138
Vues:
26
It depends on what "treatments that are done at any time during the entered period ie between two dates" means.
ldStartDate = ...
ldEndDate = ...
* A treatment starts or ends between specified dates
SELECT * FROM mytable ;
  WHERE StartDate BETWEEN ldStartDate AND ldEndDate ;
    OR EndDate BETWEEN ldStartDate AND ldEndDate 

* A treatment starts and ends between specified dates
SELECT * FROM mytable ;
  WHERE StartDate BETWEEN ldStartDate AND ldEndDate ;
    AND EndDate BETWEEN ldStartDate AND ldEndDate 
>Hi! I have a form that allows the user to enter a date range. The program then scans through a table looking for treatments that are done at any time during the entered period ie between two dates.
>
>So treatment 1 is usually done between 03/02 and 04/28.
>treatment 2 between 05/01 and 05/15. etc etc
>
>
>The only way I can think to do this is to loop from the entered start & end date a day at a time and check that that date falls between each treatment.
>This works fine but is a little slow, keep thinking there must be a way of doing this using an equation/syntax.
>
>Thinking about this makes my head hurt! LOL, Any ideas?
>
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform