patternsqlMinor
Put Postgres query result in array
Viewed 0 times
resultpostgresarrayqueryput
Problem
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
This is my first request, sorry if I made some format mistake.
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.
Solution
You can use an array constructor:
select array(
select zone
from mytable)
as areas;Code Snippets
select array(
select zone
from mytable)
as areas;Context
StackExchange Database Administrators Q#100813, answer score: 7
Revisions (0)
No revisions yet.