17,086
社区成员
发帖
与我相关
我的任务
分享
select distinct
yy.id,
T1.name,
ltrim(first_value(path) over(partition by yy.id order by lev desc)) as values_nums
from (
select zz.*,
sys_connect_by_path(zz.values_num,',') as path,
level lev
from (
select tt.id,
tt.Value1||'-'||tt.Value2 as values_num,
tt.id||(row_number() over(partition by tt.id)-1) front_data,
tt.id||row_number() over(partition by tt.id) behind_data
from T2 tt
)zz
connect by prior zz.front_data = zz.behind_data
)yy,
T1
where yy.id = T1.id;