sql >> Base de Datos >  >> RDS >> PostgreSQL

Postgres:agregue dos columnas en un elemento

SELECT user_id, array_agg((friend_id, confirmed)) as friends
FROM friend_map
WHERE user_id = 1
GROUP BY user_id

user_id |           array_agg            
--------+--------------------------------
      1 | {"(2,true)","(3,false)","(4,false)"}