2011-01-31 53 views
0

可能重複:
Is there an Oracle SQL query that aggregates multiple rows into one row?
Agregate rows in Oracle SQL statement查詢來獲取列值逗號分隔

我與Oracle 10g的工作。我想從表中的一列中用逗號分隔字符串。

例如

Table : Customer   
Columns: id and name 

數據:

id-------name 

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

查詢的輸出應該喬恩,高爾特,霍華德,洛克

+0

我相信我的要求比您提到的線索中的問題簡單得多。 – Sid 2011-01-31 22:14:16

+1

這裏是另一個相關的問題:http://stackoverflow.com/questions/1788011/transpose-select-results-with-oracle(和最佳答案:http://www.sqlsnippets.com/en/topic-11591.html )。 – 2011-01-31 22:14:26

回答

1

好,我知道,我想要的是這樣的:

SELECT WM_CONCAT(NAME) FROM CUSTOMER; 

將所有評論標記爲+1。多謝你們。