Oracle:将子查询中的多个结果合并为单个逗号分隔值
我正在尝试将单列子查询转换为命令分隔的 VARCHAR 类型的值列表。
I'm trying to convert a single-columned subquery into a command-separated VARCHAR
-typed list of values.
This is identical to this question, but for Oracle rather than SQL Server or MySQL.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Tim Hall 网站上有关于可用字符串聚合技术的精彩总结。
There is an excellent summary of the available string aggregation techniques on Tim Hall's site.
我发现这似乎有效。 想法?
I found this that seems to work. Thoughts?
11.2 引入了 LISTAGG,与 WM_CONCAT 不同,它是有文档记录的。 自定义聚合函数也可以做到这一点。
11.2 introduced LISTAGG, which unlike WM_CONCAT is documented. A custom aggregate function could also do this.
SELECT deptno, wm_concat(ename) AS 员工
来自员工
按部门分组;
参考:http://forums.oracle.com/forums/thread .jspa?messageID=1186901�
SELECT deptno, wm_concat(ename) AS employees
FROM emp
GROUP BY deptno;
Reference: http://forums.oracle.com/forums/thread.jspa?messageID=1186901�