2016-10-17 26 views

回答

1

如果您需要您的結果列於單列中,您可以使用LISTAGG

with emp(s_id, s_inv) as 
(
    select 1, 12 from dual union all 
    select 2, 12 from dual union all 
    select 3, 12 from dual union all 
    select 4, 12 from dual union all 
    select 5, 12 from dual 
) 
select listagg(s_id, ' ') within group (order by s_id) 
from emp 
where s_inv = 12 

如果您需要在同一行建立多列,你應該先確定有多少列將你的結果有

+0

Upvoted因爲這正確地給出答案的問題(其中OP不適合行問是列還是任何數據要轉)。如果可能的話,我會再次贊成清晰的工作代碼示例。 – Lunc

相關問題