Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Wich Birthdays for two given dates
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00363237
Message ID:
00363365
Views:
15
>This works too, I just didn't give the my original too much thought
>lnyear = YEAR(DATE())
>SELECT *;
>  FROM CLIENTS;
>  WHERE BETWEEN(DATE(lnyear, MONTH(clients.dob), DAY(clients.dob)), dstart, dend)
Empty birthdates shouldn't be allowed.< g >

This will not work properly if dstart and dend belong to different years, i.e for the period starting say, in November and ending in February.

This one-liner will work in VFP 3, 5, 6 and 7 :) and it is not using any kind of date parsing, concatenation and CTOD() stuff.

SELECT * FROM CLIENTS ;
WHERE BETWEEN(GOMONTH(birth_date,(YEAR(start_date)- YEAR(birth_date))*12), start_date, end_date ) ;
OR BETWEEN(GOMONTH(birth_date,(YEAR(end_date)- YEAR(birth_date))*12), start_date, end_date)
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform