Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to remove duplicates with LISTAGG

RDN82Aug 21 2020 — edited Aug 21 2020

I am using LISTAGG to collapse my data, have duplicate values staggard on a row. When I do it, its giving me duplicates. My oracle verision is 12 I think so I cant use   DISTINCT inside LISTAGG. Does anyone know how I can fix this?

SELECT

  col1,

  col2,

  col3,

  col4,

col5,

  listagg( col6, ', ')within group (order by col6) as policies ,

  col7

 

FROM my_table

group by

col1,

  col2,

  col3,

  col4,

col5,

col7

This post has been answered by mathguy on Aug 21 2020
Jump to Answer
Comments
Post Details
Added on Aug 21 2020
4 comments
6,769 views