Използване на SQL Fiddle : select LISTAGG(name, ',') WITHIN GROUP (ORDER BY 1) AS names from temp_table