对于获取多行的查询,需要逗号分隔输出

时间:2012-11-01 16:44:58

标签: sql plsql oracle11g

查询:

select o.candidateid 
from onboardingcandidates o, candidatedetails c 
where o.candidateid=c.candidateid 
    and o.JOININGSTATUS='0091' 
    and to_date(o.joiningdate)=to_date(sysdate+5);

Output:

cand1
cand2
cand3
cand62

Required Output:

cand1, cand2, cand3, cand62

1 个答案:

答案 0 :(得分:6)

使用 LISTAGG

SELECT LISTAGG(o.candidateid) WITHIN GROUP () .....