I have below query:
SELECT xmlagg(xmlparse(content RESULTS || '|' wellformed) ORDER BY RESULTS).getclobval() AS RESULTS
FROM
(
SELECT distinct ' ' || result|| ' - ' || result_final || ' xxx' as RESULTS from myTable where ID = '123456'
);
Currently the " xxx" will append at the end of each result_final, how can achieve by concatenating it to the very beginning of the final string of the query?
' xxx'|| RESULTS
With condition, above concatenation should only take place when result=x, else only RESULTS should be printed.
Move that string in front of the "result" not behind it.
Though, as additional condition should be met, use your current query (without 'xxx') as a subquery and apply condition via
CASE.With dummy sample data: