hive sql报错ParseException in subquery source
org.apache.hadoop.hive.ql.parse.ParseException:line 368:18 cannot recognize input near ‘group’ ‘by’ ‘order_phone_num’ in subquery source
sql:
customer_Flag as (
select order_phone_num,
concat_ws(';', collect_list(c)) as a,
sum(customer_flag) as b
from (
select order_phone_num,
customer_flag,
concat_ws(',', collect_list(cast(r_diff as string))) as c
from add_payment_period
group by order_phone_num,
customer_flag
)
group by order_phone_num
),
解决办法:给最外层的group by order_phone_num加上一个别名c1
customer_Flag as (
select order_phone_num,
concat_ws(';', collect_list(c)) as a,
sum(customer_flag) as b
from (
select order_phone_num,
customer_flag,
concat_ws(',', collect_list(cast(r_diff as string))) as c
from add_payment_period
group by order_phone_num,
customer_flag
) c1
group by order_phone_num
),