Selecting data into a Postgres array

后端 未结 2 2032
你的背包
你的背包 2020-11-27 07:23

I have the following data:

name          id             url

John          1              someurl.com
Matt          2              cool.com
Sam           3           


        
2条回答
  •  隐瞒了意图╮
    2020-11-27 08:03

    You need to use an aggregate function; array_agg should do what you need.

    SELECT array_agg(s) FROM (SELECT name, id, url FROM the_table ORDER BY id) AS s;
    

提交回复
热议问题