Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Wich Birthdays for two given dates
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00363237
Message ID:
00363365
Vues:
14
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform