I was doing like the following query and received "not a single-group group function" error.
select distinct a.col1,
a.col2,
rtrim(xmlagg(xmlelement(e, b.col1 ||',')).extract('//text()'), ','),
rtrim(xmlagg(xmlelement(e, b.col2 ||',')).extract('//text()'), ',')
from table1 a
where a.col3 like '%string%'
left join table2 b on (a.pid = b.pid);
I did left join between table1 and table2 and I need to aggregate multiple rows into one row. So I wrote:
rtrim(xmlagg(xmlelement(e, b.col1 ||',')).extract('//text()'), ','),
rtrim(xmlagg(xmlelement(e, b.col2 ||',')).extract('//text()'), ',')
But when I attempt to do this, I received an error:
ORA-00937 not a single-group group function
I am not using any aggregations in select statement. What should I do to write rtrim(... ) without the error?
Thanks in advance.