Mysql
 sql >> Database >  >> RDS >> Mysql

Come ottenere un'età da un campo D.O.B in MySQL?

SELECT DATE_FORMAT(NOW(), '%Y') - DATE_FORMAT(dob, '%Y') - (DATE_FORMAT(NOW(), '00-%m-%d') < DATE_FORMAT(dob, '00-%m-%d')) AS age