Mysql计算出年纪

SELECT usertime,YEAR(NOW())-LEFT(usertime,4) AS birth
FROM ocms_user

结果:

你可能感兴趣的:(mysql,user)