JD_L
-
mysql精确查年龄
已知出生年月日,求到今天为止多少岁 select *, –如果当前月份大于出生月,年龄 = 当前年份 – 出生年 if (month(current_date())-month(substr(id_card,7,8))>0, year(current_date())-year(substr(id_card,7,8)), –如果当前月份小于出生月,年…
已知出生年月日,求到今天为止多少岁 select *, –如果当前月份大于出生月,年龄 = 当前年份 – 出生年 if (month(current_date())-month(substr(id_card,7,8))>0, year(current_date())-year(substr(id_card,7,8)), –如果当前月份小于出生月,年…