title: Duplicate value in XMLAGG and RTRIM SQL Query
body: <p>The Below query brings in duplicate values</p>
  
  <pre><code>SELECT maxuser.userid,
         person.displayname,
         maxuser.status,
         sod_Report.severity,
         sod_Report.scenario,
         RTRIM(XMLAGG(Xmlelement(E,groupuser.groupname,',').EXTRACT('//text()')   ORDER BY groupuser.groupname).GetClobVal(),',') groupname 
  FROM   maxuser
         INNER JOIN person
                 ON maxuser.userid = person.personid
         LEFT OUTER JOIN maximo.groupuser
                      ON maxuser.userid = groupuser.userid
                         AND maxuser.userid = person.personid
         LEFT OUTER JOIN sod_report
                      ON sod_report.userid = maxuser.userid
                         AND sod_report.userid = person.personid
  WHERE  1 = 1
         AND (( maxuser.userid LIKE '%XX%' ))
  GROUP  BY maxuser.userid,
            person.displayname,
            maxuser.status,
            sod_Report.severity,
            sod_Report.scenario 
  </code></pre>
  
  <p>The output is coming as below</p>
  
  <pre><code>USERID  DISPLAYNAME  GROUPNAME 
   XXXX    Test User   A1,A1,B1,B1,C1,C1
  </code></pre>
  
  <p>Expected output </p>
  
  <pre><code>USERID  DISPLAYNAME  GROUPNAME 
  XXXX    Test User    A1,B1,C1
  </code></pre>
  
  <p>I have to use <code>RTRIM</code> and <code>XMLAGG</code> since the output of <code>GROUPNAME</code> should be displayed in single line separated by commas. This is for Oracle database , Please advise. </p>