Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

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);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #select #row #include #list #array #join #table #SQL
ADD COMMENT
Topic
Name
3+1 =