LISTAGG - Rows to list

726 Views


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.

 

IBM Docs - LISTAGG

RPGPGM.COM- Using SQL to aggregate columns into one returned result

IT JUNGLE - Scalar Use of LISTAGG

Post Comments