Posts

Showing posts from February, 2018

LISTAGG() - Built function - My recent favorite

Image
The LISTAGG function aggregates a set of string elements into one string by concatenating the strings. Optionally, a separator string can be provided which is inserted between contiguous input strings. Table results - "Select * from Animals" Table results with LISTAGG() - SELECT SP_GROUP, SUB_GROUP,  LISTAGG(rtrim(NAME),',')  WITHIN    GROUP(ORDER BY NAME)  FROM animals  GROUP BY SP_GROUP, SUB_GROUP This function will be a great help in providing a easy to read reports to users.