hive 计算年龄

if(datediff(b.admission_time,
        CONCAT(substring(b.admission_time, 0, 4),
        substring(b.date_of_birth, 5, 7)))>= 0,
        (substring(b.admission_time, 0, 4) - substring(b.date_of_birth, 0, 4)),
        (substring(b.admission_time, 0, 4) - substring(b.date_of_birth, 0, 4)-1)) as year_dv

 

你可能感兴趣的:(Hive)