Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

select a row include list of array with join table SQL

SELECT id, i.title AS item_title, t.tag_array
FROM   items      i
JOIN  (  -- or LEFT JOIN ?
   SELECT it.item_id AS id, array_agg(t.title) AS tag_array
   FROM   items_tags it
   JOIN   tags       t  ON t.id = it.tag_id
   GROUP  BY it.item_id
   ) t USING (id);
Source by dba.stackexchange.com #
 
PREVIOUS NEXT
Tagged: #select #row #include #list #array #join #table #SQL
ADD COMMENT
Topic
Name
9+3 =