-3

请帮助如何编写 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. :) 
4

1 回答 1

1
select   col1, listagg(col2, ',') within group (order by col2) as new_col_name
from     table_name
group by col1;
于 2016-05-12T19:22:56.913 回答