hive 计算年龄

--effective_date 可以是当前日期,也可以是数据中中数据的创建日期

--
计算年龄 , if( datediff(ui.effective_date , CONCAT(substr(ui.effective_date , 0, 4), substr(uip.user_birthday, 5, 7)))>=0, (substr(ui.effective_date , 0, 4) - substr(uip.user_birthday, 0, 4)), (substr(ui.effective_date , 0, 4) - substr(uip.user_birthday, 0, 4) - 1) ) as uip_user_age

 

posted @ 2021-08-10 17:55  monkey66  阅读(1182)  评论(0编辑  收藏  举报