mysql用身份证号算年龄性别生日
性别
IF (MOD(SUBSTRING(o.patient_id_card,17,1),2),'男','女') AS gender,
年龄
(YEAR(CURDATE()) - SUBSTRING(o.patient_id_card,7,4)) AS age,
生日
cast(substring(o.patient_id_card,7,8) as date) as birth,
posted on 2023-06-13 10:30 rachelgarden 阅读(76) 评论(0) 编辑 收藏 举报