hive 行转列后怎么去重且有序
2018-04-28 本文已影响9人
在下吳
select id,concat_ws(',',sort_array(collect_list(name))) name from table group by id;
先把多行合并成数组,再排序,再逗号分割。
select id,concat_ws(',',sort_array(collect_list(name))) name from table group by id;
先把多行合并成数组,再排序,再逗号分割。