
May 22nd, 2012, 02:52 AM
|
|
Registered User
|
|
Join Date: Sep 2011
Posts: 7
Time spent in forums: 37 m 48 sec
Reputation Power: 0
|
|
|
How to merge results of the arrays in PgSQL
Assuming I have two fields in a table, like this:
Column | Type |
--------+-----------+
id | integer |
value | integer[] |
SELECT * FROM t1;
id | value
----- +-----------------------------------
1 | {1, 2, 3}
2 | {1, 4}
3 | {1, 5}
How would I make a query which returns a array, returned the merged the t1.values, i.e. something like:
SELECT some_array_function(value) as newarray FROM t1;
new_array
--------------------------------
{1, 2, 3, 4, 5}
Thanks!
|