Postgresql GROUP_CONCAT equivalent?

后端 未结 7 2144
清酒与你
清酒与你 2020-11-22 03:04

I have a table and I\'d like to pull one row per id with field values concatenated.

In my table, for example, I have this:

TM67 | 4  | 32556
TM67 | 9         


        
相关标签:
7条回答
  • 2020-11-22 04:02

    Hope below Oracle query will work.

    Select First_column,LISTAGG(second_column,',') 
        WITHIN GROUP (ORDER BY second_column) as Sec_column, 
        LISTAGG(third_column,',') 
        WITHIN GROUP (ORDER BY second_column) as thrd_column 
    FROM tablename 
    GROUP BY first_column
    
    0 讨论(0)
提交回复
热议问题