mysql获取18位和15位身份证号中的出生日期、年龄
mysql获取18位和15位身份证号中的出生日期、年龄
18位身份证号码
select cast(substring(idno,7,8) as date) as 出生日期,2022-substring(idno,7,4) as age from tables where LEGTH(idno)=18
15位身份证号码
select cast(concat( 19
mysql获取18位和15位身份证号中的出生日期、年龄
18位身份证号码
select cast(substring(idno,7,8) as date) as 出生日期,2022-substring(idno,7,4) as age from tables where LEGTH(idno)=18
15位身份证号码
select cast(concat( 19 , substring(idno,7,6)) as date) as 出生日期, 2022-concat( 19 , substring(idno,7,2)) from tables where LEGTH(idno)=15
获取性别
// mod(id,2)=1 是指 id 是奇数
// mod(id,2)=0 是指 id是偶数
// 获取性别等于男的数据
select * from tables where length(idno)=18 mod(substring(idno, 17, 1), 2)=1
// 获取性别等于女的数据
select * from tables where length(idno)=18 mod(substring(idno, 17, 1), 2)=0
#感谢您对电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格的认可,转载请说明来源于"电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格
上传时间: 2024-02-05 13:07:09
推荐阅读
留言与评论(共有 5 条评论) |
本站网友 上海洛克篮球公园 | 17分钟前 发表 |
substring(idno | |
本站网友 高个女孩 | 17分钟前 发表 |
2022-concat( 19 | |
本站网友 hpv是什么疫苗多少钱 | 10分钟前 发表 |
substring(idno | |
本站网友 引爆点 | 0秒前 发表 |
7 |