Oracle Display the values of columns in single row without using connect by clause

327 views Asked by At

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
2

There are 2 answers

2
AudioBubble On
select deptno,
       listagg(ename,'/') within group (order by ename) as names
from temp_task
group by deptno
order by deptno;
1
Prabha Christ On

This sql query should work -

select deptno,wm_concat(ename) 
from emp_task 
group by deptno 
order by deptno