I'm just wondering if this select statement is good for age calculation:
Note : dob is date of birth in the format YYYY-MM-DD
Only situation it chokes is when dayofyear(dob) = dayofyear(curdate()).Code:SELECT YEAR(curdate()) - YEAR(dob) - IF(dayofyear(curdate()) < dayofyear(dob),1,0) as age from tbl_name
So, is this one ok, or is there something I overlooked? Also, if htere's a better one, can anyone post it here?
cheers
asT.








Bookmarks