hive:函数:条件函数(条件表达式):case when

例1:

CASE
        WHEN aer.followupdate='null'
        THEN null
        ELSE aer.followupdate
END followupdate,

例2:

CASE
		WHEN instr(O.branchno,'xiaomi')>0
		THEN '小米'
		WHEN instr(O.branchno,'huawei')>0
		THEN '华为'
		WHEN instr(O.branchno,'iphone')>0
		THEN '苹果'
		ELSE O.branchno
END      brand,

猜你喜欢

转载自blog.csdn.net/weixin_38750084/article/details/93381386