按照指定字段的值做多行合并
涉及到的功能函数concat_ws、collect_list(用于决定以哪种形式组织多个值)
select id, concat_ws(',', collect_list(val)) as info from table_name group by id
/* 效果如下
---------------------------------------
id |val
---------------------------------------
1 |'abc'
2 |'ac'
1 |'abs'
2 |'abe'
1 |'cde'
----------------------------------------
===>
---------------------------------------
id |info
---------------------------------------
1 |'abc','cde','abs'
2 |'ac','abe'
----------------------------------------
*/