> Is there an easy way to have MySQL return someone's age based on their
> birthdate? For some reason I just can't figure this one out.

select year(current_date) - year(dob) -
(if(dayofyear(dob)>dayofyear(current_date),1,0)) as Age from yourtable ...

where dob is your date of birth column. current_date is a mysql constant, so
it can be left just like that.

---John Holmes...



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to