0

This is my query

 select deptno,ename from emp_task;

Output

enter image description here

I want the output like this

eno      ename
20    TRINATH/RABHA
8     SAIKIRAN/KISHORE
10    KUMAR/VICKY/DAFNI
Prabha Christ
  • 131
  • 2
  • 2
  • 10
  • possible duplicate of [SQL Query to concatenate column values from multiple rows in Oracle](http://stackoverflow.com/questions/4686543/sql-query-to-concatenate-column-values-from-multiple-rows-in-oracle) – MT0 Jun 20 '15 at 10:21
  • 1
    Duplicate of [this](http://stackoverflow.com/q/4686543/1509264), [this](http://stackoverflow.com/q/492563/1509264), [this](http://stackoverflow.com/q/468990/1509264) and [this](http://stackoverflow.com/q/4686543/1509264) (and probably more). – MT0 Jun 20 '15 at 10:23

2 Answers2

0
select deptno,
       listagg(ename,'/') within group (order by ename) as names
from temp_task
group by deptno
order by deptno;
0

This sql query should work -

select deptno,wm_concat(ename) 
from emp_task 
group by deptno 
order by deptno
divyanshm
  • 6,600
  • 7
  • 43
  • 72
Prabha Christ
  • 131
  • 2
  • 2
  • 10
  • `wm_concat` is an unsupported and undocumented oracle function (use at your own risk); also its not present in all installations (its not available on any of the 11g instances I run). `LISTAGG` is documented and should be used instead. – MT0 Jun 22 '15 at 08:44