Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
select array[[1,2],[2,3]]
Output: -[ RECORD 1 ]-------- array | {{1,2},{2,3}}
-[ RECORD 1 ]-------- array | {{1,2},{2,3}}
How do I flat the array, so I can then unnest?
Expected {1, 2, 2, 3}
{1, 2, 2, 3}
select array[1,2,3,4]
unnest() completely flattens the array. If you need the flattened array, then unnest() and follow with an array_agg()
unnest()
array_agg()
select array_agg(el order by rn) from unnest(array[array[1,2],array[2,3]]) with ordinality as a(el, rn); array_agg ----------- {1,2,2,3} (1 row)
Add a comment
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
select array[1,2,3,4]?