想把子查询中返回的多个结果拼接成一个字符串,请问怎么搞?在线等,下面是一个例子select(select ename from
想把子查询中返回的多个结果拼接成一个字符串,请问怎么搞?在线等,下面是一个例子
select
(select ename from emp where emp.deptno= d.deptno) ename
from dept d where d.deptno=10
这样ename会返回多个结果,想把他们拼接在一起,有什么办法吗?
[解决办法]
- SQL code
SQL> select deptno, wm_concat(ename) wm from emp where deptno=10 group by deptno; DEPTNO WM ---------- -------------------------------------------------- 10 Clark,Miller,King
[解决办法]
- SQL code
select deptno, wm_concat(ename) from emp group by deptno having deptno=10;
