簡體   English   中英

oracle LISTAGG 將多行結果分組為一行不起作用。 ORA-00909

[英]oracle LISTAGG grouping multiple row results into one row not working. ORA-00909

我在這里看到一個帖子,使用 LISTAGG 將多行分組為 1 列下的一行,我查看了帖子示例和 oracle 網站,但我無法使查詢工作。

在 sql developer 中,錯誤是 ORA-00909: invalid number of arguments

我有以下查詢

select d.id, d.name, d.date_sale, d.address, d.city, d.state, d.zipcode, d.description, d.explanation, d.received_date, 
       listagg(dd.my_id, dd.customer_name, dd.category, dd.transaction_date, ';' 
       ) within group (order by dd.transaction_date)
from table1 d
left join table2 dd on d.id = dd.my_id
where d.id =1 and d.isActive =1

任何幫助表示贊賞。

將值連接在一起並添加一個group by

select d.id, d.name, d.date_sale, d.address, 
       listagg(dd.my_id || dd.customer_name || dd.category, dd.transaction_date, ';' 
              ) within group (order by dd.transaction_date)
from table1 d left join
     table2 dd
     on d.id = dd.my_id
where d.id =1 and d.isActive = 1
group by d.id, d.name, d.date_sale, d.address;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM