select
id,
if (CHAR_LENGTH(sfzh)<18,(substring(now(),1,4)-(1900+substring(sfzh,7,2)))-(substring(sfzh,9,4)-date_format(now(),'%m%d')>0),
(substring(now(),1,4)-substring(sfzh,7,4))-(substring(sfzh,11,4)-date_format(now(),'%m%d')>0)) as age,
sfzh
from 0_5_jzygjbqkylb
sql的身份证号计算年龄
最新推荐文章于 2024-03-21 16:30:27 发布