嵌套大小写错误:输入不匹配';AS';预期功率端在'附近;结束';在case表达式中:Hive

嵌套大小写错误:输入不匹配';AS';预期功率端在'附近;结束';在case表达式中:Hive,hive,case,Hive,Case,我想在蜂箱里执行这个案子 select case when (hour(rand_date)>=0 and hour(rand_date)<6) then 'early_morning' else case when (hour(rand_date)>=6 and hour(rand_date)<12) then 'morning' else case when (hour(rand_date)>=12 and hour(rand_date)<18) th

我想在蜂箱里执行这个案子

select case when (hour(rand_date)>=0 and hour(rand_date)<6) then 'early_morning' else 
case when (hour(rand_date)>=6 and hour(rand_date)<12) then 'morning' else 
case when (hour(rand_date)>=12 and hour(rand_date)<18) then 'afternoon' else
case when (hour(rand_date)>=18 and hour(rand_date)<24) then 'night' else 'other' end AS hourbins,
 rand_date from mock_ads_dates ;

选择case when(hour(rand_date)>=0和hour(rand_date)=6和hour(rand_date)=12和hour(rand_date)=18和hour(rand_date)
嵌套case语句在
配置单元中有点棘手。它应该是这样的:-

select case when (hour(rand_date)>=0 and hour(rand_date)<6) then 'early_morning' 
when (hour(rand_date)>=6 and hour(rand_date)<12) then 'morning'
when (hour(rand_date)>=12 and hour(rand_date)<18) then 'afternoon'
when (hour(rand_date)>=18 and hour(rand_date)<24) then 'night' else 'other' end AS hourbins,rand_date from mock_ads_dates ;
选择以下情况:小时(随机日期)>=0,小时(随机日期)=6,小时(随机日期)=12,小时(随机日期)=18,小时(随机日期)