1. 程式人生 > >hive根據身份證號判斷性別

hive根據身份證號判斷性別

select no_cer,case when (case when LENGTH(no_cer)=15 then substr(NO_CER,14,1) when 
LENGTH(no_cer)=18 then substr(NO_CER,17,1) end)%2=0 then '女' else '男' end from bdl_dsc_eac01_blc limit 10;