how to get enames with comma seperated values by deptwise
on emp table?

Answer Posted / kavitha nedigunta

SELECT deptno ,
LTRIM(MAX( SYS_CONNECT_BY_PATH (
ename, ',')),',') EMP_STRING
FROM
(SELECT empno , ename, deptno,
row_number() OVER ( PARTITION BY deptno ORDER
BY rownum) rn
FROM EMP )
CONNECT BY deptno = PRIOR deptno
AND rn = PRIOR rn+1
START WITH rn =1
GROUP BY deptno
ORDER BY deptno;

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is clustered index sql?

503


What is the use of index in sql?

555


What is case function?

596


What does 0 mean in sql?

526


What is the difference between function and procedure in pl/sql?

536






What is trigger in sql? Explain

535


what happens when the column is set to auto increment and you reach the maximum value for that table? : Sql dba

573


How does pl sql work?

521


What is cross join sql?

496


What is the benefit of foreign key?

522


What do you mean by dbms? What are its different types?

552


What is pivot table in sql?

522


What is data type in sql?

554


what is a constraint? Tell me about its various levels. : Sql dba

561


Which is better join or inner query?

514