oracle:
实现效果如下图:
从图一到图二显示的sql
① vm_concat(默认以逗号分隔):
select vm_concat(course) from table1 group by class
想以别的符号分割 :select vm_concat(course,'.') from table1 group by class
但是此关键字已经不太适合高版本的oracle使用了,一般建议不要使用;
② LISTADD WITHIN GROUP(ORDER BY ) (推荐使用)
select listagg(course,',') within group (order by course) from table1 group by class
想要拼接的内容去重:select listagg(distinct course , ', ') within group (order by course) from table1 group by class
注&