模擬創建語句:
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)