Oracle在不使用connect by子句的情况下显示单行中的列值

时间:2015-06-20 08:12:13

标签: sql oracle string-aggregation

这是我的查询

 select deptno,ename from emp_task;

输出

enter image description here

我想要像这样的输出

eno      ename
20    TRINATH/RABHA
8     SAIKIRAN/KISHORE
10    KUMAR/VICKY/DAFNI

2 个答案:

答案 0 :(得分:0)

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

答案 1 :(得分:0)

这个SQL查询应该有效 -

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