I am trying to calculate how old is a person in a database. Let\'s suppose to have this simple table:
student(id, birth_date);
Where
I'd suggest this:
DATE_FORMAT(NOW(),"%Y") -DATE_FORMAT(BirthDate,'%Y') -( IF( DATE_FORMAT(NOW(),"%m-%d") < DATE_FORMAT(BrthDate,'%m-%d'), 1, 0 ) ) as Age
This should work with leap-years very well ;-)