● 以特定符號串接某欄位的查詢結果 ( 這邊以逗號 "," 為串接符號 )
● 將查詢出來的多筆資料結合成一筆
以圖表示即
→
原查詢之 Oracle SQL 語法如下:
select
Column_Name
from
Table_Name
where
column1 = 'xxx';
串接語法如下:
with mv as (
select
Column_Name
from
Table_Name
where
column1 = 'xxx'
)
select
ltrim(extract(xmlagg(xmlelement("Column_Name",','||Column_Name)),'/Column_Name/text()').getstringval(),',') Column_Name
from mv;