暖心向阳  发表于 2020-8-11 11:19 显示全部楼层 楼主
create table t_case_when (id int,toll_type int, opp_access_type int, duration
int, other_col varchar(20))DISTRIBUTED BY;
select
case when toll_type = 0 then 0
when toll_type <> 0 and opp_access_type = 45 then sum(FLOOR((duration
+59)/60))
else sum(FLOOR/6))
end as b
from t_case_when as a
group by toll_type,opp_access_type;

ERROR 1149 (42000): (GBA-02SC-1001) ((`a`.`toll_type` <> 0) and
(`a`.`opp_access_type` = 45)): Unsupported expr type: 128


冉狐狸  发表于 2020-8-11 11:28 显示全部楼层 沙发
修改语句:
select
sum(case when toll_type = 0 then 0
when toll_type <> 0 and opp_access_type = 45 then FLOOR((duration
+59)/60)
else FLOOR/6))
end as b
from t_case_when as a
group by toll_type,opp_access_type;
sum(case when toll_type = 0 then 0
when toll_type <> 0 and opp_access_type = 45 then FLOOR((duration
+59)/60)
else FLOOR/6))
end as b

您需要登录后才可以回帖 登录 | 立即注册