根据身份证判断男女的规则:二代身份证为18位,判断倒数第二位,第二位若为奇数,性别为男:偶数则为女 一代身份证为15为,判断倒数第一位,规则同上. update 表名 set 表名.字段名= case when substring(表名,身份证字段,17,1)%2=1 and length(表名.身份证字段) =18 then "男" when substring(表名,身份证字段,17,1)%2=0 and length(表名.身份证字段) =18 then "女"
该博文出自:http://www.cnblogs.com/yang-guang-girl/p/5683454.html - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. NSString *sex=[self sexStrFromIdentityCard:@"139876456767892345"]; NSLog(@"--sex--%@&q
SELECT p.ID, p.IDCardNo, IF ( LENGTH(p.IDCardNo) , CAST( , ) AS DATETIME ), CAST( CONCAT( ', , ) ) AS DATETIME ) ) AS Birthday, IF ( SUBSTR( p.IDCardNo, LENGTH(p.IDCardNo) , ) , '男', '女' ) AS sex FROM users p WHERE p.IsDelete AND p.IDCardNo REGEXP '[