Link Search Menu Expand Document

ARRAY_AGG

Concatenates input values into an array.

Syntax

ARRAY_AGG(<expression>)

Parameters

Parameter Description Supported input type
<expression> Expression of any type to be converted to an array. Any

Return Type

ARRAY of the same type as the input data

Example

For the following example, see the player_information table:

nickname playerid
stephen70 1
burchdenise 7
sabrina21 23

This example code selects the columns in the player_information table and returns the values in two arrays, nicknames and playerids.

SELECT
  ARRAY_AGG(nickname) AS nicknames,
  ARRAY_AGG(playerid) AS playerids
FROM
	price_list;

Returns: ['stephen70', 'burchdenise', 'sabrina21'], [1, 7, 23]