Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Wich Birthdays for two given dates
Message
 
To
25/04/2000 14:00:21
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00363237
Message ID:
00363257
Views:
18
>
>*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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform