Search
 
SCRIPT & CODE EXAMPLE
 

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);
Comment

select a row include list of array with join two table SQL

SELECT e.aid, e.actors, a.act_names, e.benefactors, b.ben_names
FROM   eg_assoc e
, LATERAL (
   SELECT ARRAY( SELECT name
                 FROM   generate_subscripts(e.actors, 1) i
                 JOIN   eg_person p ON p.id = e.actors[i]
                 ORDER  BY i)
   ) a(act_names)
, LATERAL (
   SELECT ARRAY( SELECT name
                 FROM   generate_subscripts(e.benefactors, 1) i
                 JOIN   eg_person p ON p.id = e.benefactors[i]
                 ORDER  BY i)
   ) b(ben_names);
Comment

PREVIOUS NEXT
Code Example
Sql :: Which MySQL statement is used to delete data from a database 
Sql :: trigger vérifier stock 
Sql :: does laravel validate sql 
Sql :: c# sql transaction multiple connections 
Sql :: denormalise SQL command 
Sql :: can you create views in dbbrowser 
Sql :: difference table 
Sql :: How to group by week (7 days) in SQL Server 
Sql :: oracle chain step succeeded 
Sql :: Insert Row Providing Value Explicitly 
Sql :: least orders 
Sql :: SQL ANY and ALL with Comparison Operators 
Sql :: reorder primary key mysql 
Sql :: oracle synonym procedure dblink 
Sql :: sql values that contains certain multiple ids 
Sql :: sql find record cannot cast date 
Sql :: drop check command 
Sql :: how to query all tables mysql at the same time 
Sql :: create mysql pool connection python flask 
Sql :: where to find job 0x.. in ddlevents 
Sql :: sql datediff db2 
Sql :: delete query 
Sql :: my sql alter table 
Sql :: oracle temp tablespace size 
Sql :: bulk insert sql query syntax 
Sql :: difference berween database and data base management system 
Sql :: how to retrive image from sql to picturebox usinf image location 
Csharp :: how to make a hello world program in c# 
Csharp :: c# get user directory 
Csharp :: c# alphabet array 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =