You are describing a basic pivot query. Either do the query the 8i/9i way...
http://www.adp-gmbh.ch/ora/sql/examples/pivot.html
Or look into using analytics.
Code:SELECT deptno, MAX(sys_connect_by_path(ename, ' ' )) scbp FROM (SELECT deptno, ename, row_number() over (PARITION BY deptno ORDER BY ename) rn FROM emp ) START WITH rn = 1 CONNECT BY PRIOR rn = rn - 1 AND prior deptno = deptno GROUP BY deptno ORDER BY deptno;




Reply With Quote