Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Wich Birthdays for two given dates
Message
 
À
25/04/2000 14:00:21
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00363237
Message ID:
00363257
Vues:
16
>
>*dob = birthdate, dstart = initial date, dend = final date
>
>SELECT * FROM clients ;
>   WHERE MONTH(clients.dob) >= MONTH(dstart) AND ;
>         MONTH(clients.dob) <= MONTH(dend) AND ;
>         DAY(clients.dob) >= DAY(dstart) AND ;
>         DAY(clients.dob) <= DAY(dend)
>
Gonz,

Won't work if the day number returned by DAY() for the dstart variable is larger than the value returned by DAY(dend).

I haven't given this much thought, but the first thing that comes to mind is, unfortunately, a UDF.
SELECT * FROM clients;
  WHERE DateRange(clients.dob, dstart, dend)

FUNCTION DateRange
  * VFP 6.0 required
  LPARAMETERS tDOB, tdStart, tdStop
  
  LOCAL llresult, lnmonth, lnday, ldthisdate
  lnmonth = MONTH(tDOB)
  lnday = DAY(tDOB
  ldthisdate = DATE(YEAR(DATE()), lnmonth, lnday)
  llresult = BETWEEN(ldthisdate, tdStart, tdStop)
  RETURN llresult
ENDFUNC
I'm not sure if this can even be done without the UDF. 'Course, haven't really given it a lot of thought.< g >
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform