This question already has an answer here:
I'm using Oracle 10 g, I have a scenario similar to this:
No Name
-- -----
1 Rony
1 James
1 Aby
2 Sam
2 Willy
3 Mike
I need to aggregate and concatenate the strings (with a single space in between), in a way to get the results:
No Name
-- -----
1 Rony James Aby
2 Sam Willy
3 Mike
I'm using Oracle 10g and have to implement this using SQL and not PL/SQL. Is there a way out?
Try this query
Here is your sql demo
It is easy on 11G, you can use the LISTAGG function, but sadly not on 10G
There are some techniques here for earlier versions however they do require a function to be written.
http://www.oracle-base.com/articles/misc/string-aggregation-techniques.php
Try this SQL query
you can use LISTAGG
see demo here