The LISTAGG function aggregates a set of string elements into one string by concatenating the strings.
File data of depts: Biology Chemistry Physiscs Maths English select listagg(trim(Name),',') as list from depts
Result: Biology, Chemistry, Physiscs, Maths, English
LISTAGG aggregates Mutliple rows into single string.
RPGPGM.COM- Using SQL to aggregate columns into one returned result