Oracle concatente column for different rows

I have the following data and want to concatenate the last column  (4) where the first three are the same. Note column 3 indicates if its part 0 or part 1 so that could be used to indicate that if its a 1 it belongs to the previous row

Columns
1                                      2                              3      4
VAG_AB,      interaction,      gadget-statistics      ,0,      CCStat-CallInQueue_Chat_AB,
VAG_AB,      interaction,      kpi.displayed-kpis      ,0,      KPI-InboundChat,KPI-TransferredChat,KPI-TalkTime_Chat,KPI-Log
VAG_AB,      interaction,      kpi.displayed-kpis      ,1,      inTime_Twitter,KPI-NotReadyTime_Facebook
pcombAsked:
Who is Participating?
 
MikeOM_DBACommented:
In Oracle try something like this:
SELECT C1
     , C2
     , C3
     , LISTAGG ( C4, ', ' ) WITHIN GROUP (ORDER BY C4) AS C4list
  FROM Mytable
GROUP BY C1, C2, C3

Open in new window

0
 
sdstuberCommented:
what should the final output look like?
0
 
pcombAuthor Commented:
sdstuber - I am trying to do it in Oracle but ideally it would be portable to SQL Server also but not critical
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
sdstuberCommented:
ok, what versions of each platform?

and...

what should the final output look like?
0
 
pcombAuthor Commented:
sdstuber sorry shuold have included that
Columns
1                                      2                              3      4
VAG_AB,      interaction,      gadget-statistics      ,0,      CCStat-CallInQueue_Chat_AB,
VAG_AB,      interaction,      kpi.displayed-kpis      ,0,      KPI-InboundChat,KPI-TransferredChat,KPI-TalkTime_Chat,KPI-Log, inTime_Twitter,KPI-NotReadyTime_Facebook
0
 
pcombAuthor Commented:
worked great thank you
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.