需求:按照项目名,以逗号合并参与人
presto
select
item_name
,array_join(array_agg(name),',') as group_name
from
test.test_04
group by
item_name
order by item_name
hive
select
item_name
,concat_ws(',',collect_set(name)) as group_name
from
test.test_04
group by
item_name
order by item_name
文章来源:https://www.toymoban.com/news/detail-601597.html
mysql
select
item_name,
group_concat(name,',') as group_name
from
test_prc
group by item_name
文章来源地址https://www.toymoban.com/news/detail-601597.html
到了这里,关于三种SQL实现聚合字段合并(presto、hive、mysql)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!