In my nuke_users table, I have been gathering birthdates. It's sitting in field "birth" as a date 0000-00-00 (YYYY-MM-DD)
I would like to write a block, which will show which users have a birthday today. I am a NEWBIE to sql statements. I have figured out how to extract all users with their ids and birthdays with this statement:
SELECT id, ffusername, birth FROM nuke_users
But I don't know how to extract users who have a birthday TODAY. I know I need to extract a month and date and then see if its equal to todays month and todays date, but I don't know how to extract month and date from a field which has YYYY-MM-DD together all in one field and then how to write it so it says its equal to today's month/date.
If there are any SQL gurus out there, please kindly help. THANKS!
ss-snake Private
Joined: Nov 17, 2004
Posts: 39
Posted:
Fri Apr 08, 2005 9:22 am
try "SELECT id, ffusername, birth FROM nuke_users where birth=SYSDATE"
I think the MySQL code for the current date is "SYSDATE". If im wrong, do a quick little search on google.
This will compare your the entries in your "birth" field to the current system date and extract only those dates that match the system date.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum