Reputation: 3230
I have a table containing many rows
I want to all rows of a column to be concatenated to single row
e.g
columns
-------
a
b
c
d
e
i want to have following result
a,b,c,d,e
Upvotes: 0
Views: 562
Reputation: 117571
create table test (a text);
insert into test
values ('a'), ('b'), ('c'), ('d'), ('e');
select string_agg(a, ',') from test
Upvotes: 2
Reputation: 2505
SELECT
array_to_string(array_agg("column"),',') AS yourColumn
FROM Table1
check to see you answer demo
Upvotes: 1