How to remove duplicates when SQL output is in XML format?
Hello,
I run this script to get the XML output from my SQL query:
select dbms_xmlgen.getxml('select dept.deptno dn, emp.job jb, emp.ename en from scott.emp emp, scott.dept dept where dept.deptno = emp.deptno and dept.deptno = 20 order by 1, 2, 3') xml from dual;
Here is the output:
As you can see, deptno and job have been repeated. How can I achieve result in which deptno and job just appear once like below but in XML format:
Please help.
Thanks,
Ning