-
Assume I have a table like the following:
I would like to do something like the following:
or even
Is this currently possible in duckdb? |
Beta Was this translation helpful? Give feedback.
Answered by
lnkuiper
Jun 8, 2022
Replies: 2 comments
-
I believe you are looking for the D create table tbl (col varchar);
D insert into tbl values ('a'), ('b'), ('c'), ('c');
D select 'col' as column, list(col) as values from tbl;
┌────────┬──────────────┐
│ column │ values │
├────────┼──────────────┤
│ col │ [a, b, c, c] │
└────────┴──────────────┘
D select 'col' as column, list(distinct col) as values from tbl;
┌────────┬───────────┐
│ column │ values │
├────────┼───────────┤
│ col │ [a, b, c] │
└────────┴───────────┘ |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Admolly
-
Yes, perfect @lnkuiper! That is exactly what I was looking for. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I believe you are looking for the
list
aggregate function: