9951 explained code solutions for 126 technologies


clickhouseUsing groupArray in queries


SELECT date, groupArray(col) FROM tbl GROUP BY datectrl + c
tbl

table to select data from

date

column to group by

groupArray

will group all column values into an array

col

column which values to group into an array


Usage example

SELECT date, groupArray(col) FROM tbl GROUP BY date
output
┌───────date─┬─groupArray(col)─────────────────────────────────────────────────────────────────────────────┐
│ 1970-01-01 │ ['hi','Donald','hi','Donald','hi','Donald','hi','Donald','hi','Donald']                     │
│ 2022-01-07 │ ['Donald','Donald','Donald','Donald','Donald','Donald','Donald','Donald','Donald','Donald'] │
│ 2022-01-10 │ ['Donald','Donald','Donald','Donald','Donald']                                              │
│ 2022-01-11 │ ['Donald','Donald','Donald','Donald','Donald','Donald','Donald','Donald','Donald','Donald'] │
│ 2022-01-12 │ ['Donald','Donald','Donald','Donald','Donald']                                              │
│ 2022-01-14 │ ['hi','good']                                                                               │
└────────────┴─────────────────────────────────────────────────────────────────────────────────────────────┘