Hive 配置单元SQL,如何在组中包含多个列?
我有如下数据:Hive 配置单元SQL,如何在组中包含多个列?,hive,hql,impala,group-concat,Hive,Hql,Impala,Group Concat,我有如下数据: Customer DUNS Employees A 1 60 A 2 100 A 3 15 A 4 40 我想要的是: Customer NEW CONCAT FIELD A 1:60, 2:100
Customer DUNS Employees
A 1 60
A 2 100
A 3 15
A 4 40
我想要的是:
Customer NEW CONCAT FIELD
A 1:60, 2:100, 3:15, 4:40
以下是我到目前为止的情况:
Select
Customer
,group_concat(cast(DUNS as string)) as DUNS
,group_concat(cast(Employees as string)) as 'Emps'
From MyTable
group by Customer
结果如下:
Customer DUNS EMPS
A 1, 2, 3, 4 60,100,15,40
我只是在努力将这些结合到一个领域。我发现MySQL语法看起来像我需要的,但在我的cloudera/Impala编辑器中不起作用
就我的一生而言,我找不到以前在哪里做过这件事,但我确信这是在什么地方。如何编辑此查询以获取“新CONCAT字段”
select Customer,collect_list(duns_employees) as duns_employees_list from
(
select Customer,CONCAT(DUNS,':',Employees) as duns_employees from table
) a
group by Customer;