get distinct values

From: webtourist <webtourist_at_gmail.com>
Date: Fri, 12 Mar 2010 13:58:12 -0800 (PST)
Message-ID: <dd99e32d-b4fa-443c-9c2d-65b56c2e3164_at_t41g2000yqt.googlegroups.com>



> SELECT deptno,

2 substr(REPLACE(REPLACE(xmlagg(xmlelement("x", job) ORDER BY job), '</x>'), '<x>', ' '), 2) job_list
3 FROM emp
4 GROUP BY deptno
5 ORDER BY deptno
6/

DEPTNO JOB_LIST

------ ----------------------------------------------------

    10 CLERK MANAGER PRESIDENT
    20 ANALYST ANALYST CLERK CLERK MANAGER     30 CLERK MANAGER SALESMAN SALESMAN SALESMAN SALESMAN How can I get result like this: (distinct names in "job_list") ?

DEPTNO JOB_LIST

------ ----------------------------------------------------

    10 CLERK MANAGER PRESIDENT
    20 ANALYST CLERK MANAGER
    30 CLERK MANAGER SALESMAN Received on Fri Mar 12 2010 - 15:58:12 CST

Original text of this message