Oracle listagg去重的两种方法

一:SELECT DISTINCT

       TYPE,

       SUBTYPE,

       LISTAGG (EN, ' | ')

          WITHIN GROUP (ORDER BY EN)

          OVER (PARTITION BY TYPE, SUBTYPE)

          AS SKILLS

  FROM (SELECT DISTINCT TYPE, SUBTYPE, EN

          FROM IKB

         WHERE SUBTYPE IN ('Technology_Database', 'test'))

二:

 regexp_replace((listagg(OV.PNR, ',' ) within group (order by OV.PNR)), '([^,]+)(,\1)+', '\1')

 

 

 

你可能感兴趣的:(Oracle)