oracle

 drop table test;
create table test(a varchar2(30),b varchar2(30),c varchar2(30));
insert into test values('aaa','1','a');
insert into test values('bbb','2','a');
insert into test values('ccc','5','a');
insert into test values('ddd','3','a');
insert into test values('aaaaa','11','b');
insert into test values('bbbbb','22','b');
insert into test values('ccccc','55','b');
insert into test values('ddddd','33','b');

select * from test
select c,max(a),max(b) from (
select c,wm_concat(a) over (partition by c order by a) a,
         wm_concat(b)  over (partition by c order by a) b from test
) tt
group by c ; 

原文地址:https://www.cnblogs.com/yinxingyeye/p/4995287.html