根据身份证号查询更新性别:
update uufs_ltx_info set xb= (case SUBSTRING(sfzh,17,1)&1 when 1 then '男' else '女' end) ;
根据身份证号查询更新出生日期:
select sfzh as 身份证号, cast(substring(sfzh,7,8) as date) as 出生日期, DATE_FORMAT(cast(substring(sfzh,7,8) as date), '%m-%d') as 生日 from why_uufr_ltx_lsxx20230106;
UPDATE why_uufr_ltx_lsxx20230106 set csrq=cast(substring(sfzh,7,8) as date) where LENGTH(sfzh) = 18;