unwrap postgresql array into rows

后端 未结 2 1484
梦毁少年i
梦毁少年i 2020-12-13 23:28

What is the fastest way to unwrap array into rows in PostgreSQL? For instance,

We have:

a
-
{1,2}
{2,3,4}

And we need:



        
2条回答
  •  难免孤独
    2020-12-13 23:48

    unnest --> expand an array to a set of rows

    unnest(ARRAY[1,2]) 1 2

    http://www.sqlfiddle.com/#!1/c774a/24

提交回复
热议问题