Concatenates multiple arrays into a single array. Useful when each row already contains an array and you want to merge them all into one.
ARRAY<T>Diperbarui: 13 Jun 2026ARRAY_CONCAT_AGG(expression [ORDER BY key])An array column to concatenate
Sort arrays before concatenating
1 SELECT 2 category, 3 ARRAY_CONCAT_AGG(tags) as all_tags 4 FROM `project.dataset.products` 5 GROUP BY category;
Merges all tags from products within the same category.
| category | all_tags |
|---|---|
| Electronics | ["gadget", "tech", "smart", "portable"] |
| Fashion | ["style", "trend", "casual", "formal"] |
1 SELECT 2 user_id, 3 ARRAY_CONCAT_AGG(daily_activities ORDER BY activity_date) as all_activities 4 FROM `project.dataset.user_logs` 5 GROUP BY user_id;
Merges daily activities per user in chronological order.
| user_id | all_activities |
|---|---|
| U001 | ["login", "view", "purchase", "logout", ...] |
1 SELECT 2 store_id, 3 ARRAY_CONCAT_AGG(product_ids) as all_product_ids, 4 ARRAY_LENGTH(ARRAY_CONCAT_AGG(product_ids)) as total_products 5 FROM `project.dataset.store_inventory` 6 GROUP BY store_id;
Merges all product IDs from multiple shipments.
| store_id | all_product_ids | total_products |
|---|---|---|
| S001 | [101, 102, 201, 202] | 4 |
| S002 | [101, 301, 302, 303] | 4 |
Sudah paham ARRAY_CONCAT_AGG? Latih langsung di browser
Latihan interaktif, langsung di browser.