Postgresql – Put Postgres query result in array

aggregatearraycpostgresql

How can I put an sql query result in a string array with Postgres?
I have some attributes in the column 'zone' of the table 'mytable' and I must put them all in a String[] areas;
This is my first request, sorry if I made some format mistake.

Best Answer

You can use an array constructor:

select array(
select zone
from mytable) 
as areas;