LIST function [Aggregate]

Returns a comma-delimited list of values.

Syntax
LIST( 
[ DISTINCT ] string-expression
[  , delimiter-string ] )
Parameters
  • string-expression   A string expression, usually a column name. For each row in the column, the value is added to a comma-separated list. When DISTINCT is specified, only unique values are added.

  • delimiter-string   A delimiter string for the list items. The default setting is a comma. There is no delimiter if a value of NULL or an empty string is supplied. The delimiter-string must be a constant.

Remarks

NULL values are not added to the list. LIST ( X ) returns the concatenation (with delimiters) of all the non-NULL values of X for each row in the group. If there does not exist at least one row in the group with a definite X-value, then LIST( X ) returns the empty string.

A LIST function cannot be used as a window function, but it can be used as input to a window function.

Standards and compatibility
  • SQL/2003   Vendor extension.

Examples

The following statement returns all street addresses from the Employees table.

SELECT LIST( Street ) FROM Employees;