Search Postgresql Archives

Re: noobie join question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2015-05-11 at 06:46 -0400, Steve Clark wrote:
> Hi List,
> I am having trouble trying to figure out
> how to get the result listed at the bottom.
> 
> I have 3 tables units, types of units which has a description of the units,
> and a table that list associations of the units. I can't figure out
> how to do the proper joins. Any pointers would be appreciated.

SELECT  us.udevice, ts.descr, ud.udevice, td.descr
  FROM  assoc AS a
        LEFT JOIN units AS us
           ON a.src_id = us.uid
        LEFT JOIN types AS ts
           ON us.utype = ts.id
        LEFT JOIN units AS ud
           ON a.dest_id = ud.uid
        LEFT JOIN types AS td
           ON ud.utype = td.id;




-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux