Reference Guide > TDV Support for SQL Functions > TDV-Supported Analytical Functions > LISTAGG
 
LISTAGG
LISTAGG orders data within each group specified in the ORDER BY clause, and then concatenates the values of the measure column.
Syntax
LISTAGG (expression [, delimiter_expression]) WITHIN GROUP (ORDER BY expression [ ASC | DESC ] [ NULLS { FIRST | LAST } [, ...]) OVER (PARTITION BY expression [, ...] )
Remarks
Without an OVER clause, LISTAGG is a simple aggregate function.
PARTITION BY is required if an OVER clause is used.
Example
SELECT
LISTAGG(categoryname,',') WITHIN GROUP (ORDER BY categoryid) AS ALIAS
FROM
/shared/examples/ds_inventory/tutorial/categories
 
The result is:
alias
Data Storage,External Drives,Internal Drives,Memory,Models,Printers,Networking,Processors,Video Cards