请帮助如何编写Oracle查询以获得结果(在3个单独的列中),如“ abcd 1,5,7 xyz ”从下表中,我想将COL3包含为单独的列。请帮忙
Oracle Database table
======================
col1 | col2 | col3
======================
ABCD 1 xyz
======================
EDF 3 lmn
======================
ABCD 5 xyz
======================
ABCD 7 xyz
======================
Thanks in advance. :)
答案 0 :(得分:1)
select col1, listagg(col2, ',') within group (order by col2) as new_col_name
from table_name
group by col1;