Hive 条件语句的两种情况
Two case when hive conditionals
如何在同一个 CASE WHEN 上执行两个条件,例如:
CASE
WHEN (column) LIKE '%IPHONE%' AND '%MOBILE%' THEN 'IOS'
WHEN (column) LIKE '%ANDROID%' AND '%LINUX%' THEN 'ANDROID'
WHEN (column) LIKE '%LINUX%' THEN 'DESKTOP'
ELSE 'NA'
END
我的记录显示:Iphone;移动的; Mac OS X;如何给出具有两个条件(Iphone 和 Mobile)的 LIKE 查询?
CASE
WHEN (column LIKE '%IPHONE%') AND (column LIKE '%MOBILE%') THEN 'IOS'
WHEN (column LIKE '%ANDROID%') AND (column LIKE '%LINUX%') THEN 'ANDROID'
WHEN column LIKE '%LINUX%' THEN 'DESKTOP'
ELSE 'NA'
END
如何在同一个 CASE WHEN 上执行两个条件,例如:
CASE
WHEN (column) LIKE '%IPHONE%' AND '%MOBILE%' THEN 'IOS'
WHEN (column) LIKE '%ANDROID%' AND '%LINUX%' THEN 'ANDROID'
WHEN (column) LIKE '%LINUX%' THEN 'DESKTOP'
ELSE 'NA'
END
我的记录显示:Iphone;移动的; Mac OS X;如何给出具有两个条件(Iphone 和 Mobile)的 LIKE 查询?
CASE
WHEN (column LIKE '%IPHONE%') AND (column LIKE '%MOBILE%') THEN 'IOS'
WHEN (column LIKE '%ANDROID%') AND (column LIKE '%LINUX%') THEN 'ANDROID'
WHEN column LIKE '%LINUX%' THEN 'DESKTOP'
ELSE 'NA'
END