Possible Duplicate:
How can I combine multiple rows into a comma-delimited list in Oracle?
How can you produce a comma-separated values from list of return rows in SQL without creating a function? Need to remove duplicates and null or with 'None' as the value.
Example: select name from student;
The result :
         NAME         
        ------
        Zed
        Charlo
        None
        Charlo
        Dionn
        Ansay
Desired output :
              Name
             -------
             Zed,Charlo,Dionn,Ansay
                http://sqlfiddle.com/#!4/9ad65/2
select 
  listagg(name, ',') 
    within group (order by id) as list 
from student
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With