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

Answer Posted / amitabha mandal

COLUMN employees FORMAT A50

SELECT deptno, wm_concat(ename) AS employees
FROM emp
GROUP BY deptno;

DEPTNO EMPLOYEES
---------- -------------------------------------------------
-
10 CLARK,KING,MILLER
20 SMITH,FORD,ADAMS,SCOTT,JONES
30 ALLEN,BLAKE,MARTIN,TURNER,JAMES,WARD

3 rows selected.

check tyhis link :http://www.oracle-
base.com/articles/misc/StringAggregationTechniques.php

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is query optimization in sql?

544


What is sql resultset?

527


explain the difference between bool, tinyint and bit. : Sql dba

520


What are two statement types in sql?

536


What is pls_integer in pl sql?

536






What is package in pl sql?

576


What is view explain with example?

517


Can we join two tables without common column?

512


How to pronounce postgresql?

578


How can triggers be used for the table auditing?

592


How to select 10 records from a table?

643


how many ways to get the current time? : Sql dba

526


How do you declare a constant?

523


How do you get column names only for a table (sql server)?

663


What is a design view?

518