Posted on 2014-07-28
I'm not a strong Oracle SQL coder and have a query that is taking far too long to run. What I need is for it as one of the columns to return a concatenated list of values from another table. In brief I have the following:
a, b, c,
(select ltrim(max(sys_connect_by_path(rpt_num,',')), ',')
from (select occ, rpt_num, row_number() over (partition by occ order by rownum) rn from oq)
connect by occ = prior occand rn = prior rn + 1
START WITH rn = 1
group by occ
HAVING occ= o.occ) Related_Reports
FROM TableO o
a,b, and c are other columns in my query
I suspect that I have messed something up in this, although running the sunquery as a query does return me what I need.
Any suggests or help is most welcome.