Possible Duplicate:
How can I combine multiple rows into a comma-delimited list in Oracle?可能重复:如何将多行组合到Oracle中以逗号分隔的列表中?
How can you produce a comma-separated values from list of return rows in SQL without creating a function? Need to remove duplicates and null or with 'None' as the value.
如何在不创建函数的情况下从SQL中的返回行列表生成逗号分隔值?需要删除重复项并使用null或使用“None”作为值。
Example: select name from student;
示例:从学生中选择姓名;
The result :
结果 :
NAME
------
Zed
Charlo
None
Charlo
Dionn
Ansay
Desired output :
期望的输出:
Name
-------
Zed,Charlo,Dionn,Ansay
1 个解决方案
#1
20
http://sqlfiddle.com/#!4/9ad65/2
select
listagg(name, ',')
within group (order by id) as list
from student
#1
20
http://sqlfiddle.com/#!4/9ad65/2
select
listagg(name, ',')
within group (order by id) as list
from student