1.数据表里仅仅有生日字段,想计算出其年龄的mysql语句:

SELECT *,DATE_FORMAT(FROM_DAYS(TO_DAYS(NOW( ))-TO_DAYS(生日字段)),'%Y')+0 AS age FROM 表名;

04-30 08:40