-- hive
SELECt
t.xm, t.sfzh,concat_ws(',', collect_set(t.rylx)) rylx
FROM
table t
GROUP BY
t.xm, t.sfzh
-- Presto SELECt t.xm, t.sfzh, array_join(array_agg(distinct t.rylx), ',') rylx FROM table t GROUP BY t.xm, t.sfzh

-- hive
SELECt
t.xm, t.sfzh,concat_ws(',', collect_set(t.rylx)) rylx
FROM
table t
GROUP BY
t.xm, t.sfzh
-- Presto SELECt t.xm, t.sfzh, array_join(array_agg(distinct t.rylx), ',') rylx FROM table t GROUP BY t.xm, t.sfzh