将字段去重并合并

-- 将字段去重并合并
select 
    concat_ws(',',collect_set(cast(id as string))) as wm
from (
    select 1 as id union all
    select 1 as id union all
    select 1 as id union all
    select 2 as id union all
    select 3 as id
) t1
;
原文地址:https://www.cnblogs.com/chenzechao/p/11227451.html