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 procedure explain with example?
Does inner join remove duplicates?
a table has 2 classifications 1)liabilities 2)earnings this liabitity has 2 elements with 2 input values and the earnings have 2 elements with 2 input values i wrote a query so that my input is liability savings amount1 amount2 xxxx null xxxxxx 0 xxx1 null xxxxx1 0 null yyyy 0 yyyy null yyy1 0 yyy1 my problem is --when i developed a report(d2k) with this data my o/p is liabilities,amount1,savings,amount2 xxxx xxxxxx xxx1 xxxxx1 yyyy yyyy yyy1 yyy1 how could i move this savings,savings values 2 palces up. can any body provide me witha better solution
What is rank () in sql?
Which operator is used in query for pattern matching?
How do I create a sql script?
what is a table in a database ? : Sql dba
How does sql*loader handles newline characters in a record? : aql loader
What is database white box testing and black box testing?
what is a stored procedure? : Sql dba
what is the difference between sql and t-sql? : Transact sql
What are the 3 types of behavioral triggers?
How do you update a sql procedure?
How can we store rows in PL/SQL using array?
What is left inner join in sql?