string_agg¶
Description¶
Returns concatenated input values, separated by the delimiter.
The expression must be a string column. The delimiter must be a string constant (it may be an empty string). If no ordering is specified, the default ordering is that of the invoking verb, which is generally the ‘valid_from’ timestamp, ascending.
Return type¶
string
Domain¶
This is an aggregate function (aggregates rows over a group in aggregate verbs.)
Categories¶
Usage¶
string_agg(expr, delimiter, [ order_by ])
Argument |
Type |
Optional |
Repeatable |
Restrictions |
---|---|---|---|---|
expr |
string |
no |
no |
none |
delimiter |
string |
no |
no |
constant |
order_by |
ordering |
yes |
no |
constant |
Examples¶
statsby nicknames:string_agg(nickname, ", ", order_by(email)), group_by(uid, fullname)
A list of all nicknames for each individual in the organization; for users with more than one nickname they will be sorted by email address.