oracle 查询以获取逗号分隔的列值

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4856568/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 22:35:41  来源:igfitidea点击:

Query to get column value comma separated

sqloracleoracle10g

提问by Sid

Possible Duplicates:
Is there an Oracle SQL query that aggregates multiple rows into one row?
Agregate rows in Oracle SQL statement

可能的重复:
是否有将多行聚合为一行的 Oracle SQL 查询?
Oracle SQL 语句中的聚合行

I am working with Oracle 10g. I want to have a comma separated String from a column in a table.

我正在使用 Oracle 10g。我想从表中的列中使用逗号分隔的字符串。

e.g.

例如

Table  : Customer        
Columns: id and name

Data:

数据:

  id-------name

   1-------John
   2-------Galt
   3-------Howard
   4-------Roark

Output of query should be Jon,Galt,Howard,Roark

查询的输出应该是Jon,Galt,Howard,Roark

回答by Sid

Ok, got it, all I wanted was this:

好的,明白了,我想要的只是这个:

SELECT WM_CONCAT(NAME) FROM CUSTOMER;

Marking all comments as +1. Thanks guys.

将所有评论标记为 +1。谢谢你们。