模拟创建语句:
create table a (id number,name varchar2(30),code varchar2(30));
insert into a values (1,'czb','A01,A02,A03');
select * from a;
create table b (code varchar2(30),codename varchar2(30));
insert into b values ('A01','我');
insert into b values ('A02','爱');
insert into b values ('A03','你');
select * from b;
sql语句写法:
select
id,name,code,
(select LISTAGG(codename, ', ') WITHIN GROUP (ORDER BY codename)