The LISTAGG function aggregates a set of string elements into one string by concatenating the strings.

 

Example :

Select dept,

LISTAGG(Lastname, ‘, ‘)  Within  Group(Order by Lastname)

As Employees

From Emptable

Group By Dept

Sample Result :

 

Dept              Employees

Admin            Adam, Ashley, Glen

IT                    John, Maggie, Nicolas

Sales               Shaun, Trevor, Vickie