Reputation: 383
Select id from x
gives a list of ids:
1 2 3 44 655 31
how Do i get it in one row as array? like (1,2,3,44,655,31)
(1,2,3,44,655,31)
Upvotes: 1
Views: 78
Reputation: 1159
SQLFiddle Demo
SELECT array_to_string(array_agg(id),',') as agg_id from x
Reputation: 8161
Query should be like this
SELECT string_agg(id, ',') FROM x