Oracle 函数listagg

--可以实现将多列记录聚合为一列记录,实现数据的压缩
--基本语法:listagg(xxx,xxx) within group( order by xxx)
--select id, name, sex, score from student order by id for update;

select id, name, sex, score from student;

select name,listagg(sex||''||score,' || ') within group( order by name) from student group by name;

 

posted @ 2023-02-01 15:54  wangrui1587165  阅读(104)  评论(0编辑  收藏  举报