[nmglug] mysql query

Andres Paglayan andres at paglayan.com
Tue Sep 28 15:11:29 PDT 2004


Hi All,
does anybody knows a good query that calculates age including months and 
days using mysql date functions?
I tried SELECT CURDATE( ) - dob AS age but it does bogus things when the 
month in dob is bigger than the current,
TO_DAYS( CURDATE( ) ) - TO_DAYS( dob ) AS alldays will give me the total 
days, but I am seeing no way to transform those in '1 year 3 months 5 
days'  from within mysql ,
I google it and there is plenty of calculations for the year, but 
nothing for months and days inclusive,
and it has to work before epoc,
Thank you,
Andres



-- 
Andres Paglayan
andres at paglayan.com
Ph: (505) 986-1561
Santa Fe, NM USA

Open Source is like Love. The more you share it the better it gets.





More information about the nmglug mailing list