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
What is clustered index sql?
What is the use of index in sql?
What is case function?
What does 0 mean in sql?
What is the difference between function and procedure in pl/sql?
What is trigger in sql? Explain
what happens when the column is set to auto increment and you reach the maximum value for that table? : Sql dba
How does pl sql work?
What is cross join sql?
What is the benefit of foreign key?
What do you mean by dbms? What are its different types?
What is pivot table in sql?
What is data type in sql?
what is a constraint? Tell me about its various levels. : Sql dba
Which is better join or inner query?