Skip site navigation (1) Skip section navigation (2)

Re: joins INNER, OUTER, LEFT, RIGHT, FULL, ...

From: "Roderick A(dot) Anderson" <raa(at)mailporter(dot)net>
To: Jaime Casanova <systemguards(at)yahoo(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: joins INNER, OUTER, LEFT, RIGHT, FULL, ...
Date: 2004-11-24 05:32:45
Message-ID: 41A41CFD.1020109@mailporter.net (view raw or flat)
Thread:
Lists: pgsql-admin
Jaime Casanova wrote:

>http://www.postgresql.org/docs/7.4/static/queries-table-expressions.html#QUERIES-JOIN
>  
>
Been there, done that.  Bought several tee-shirts.

>What do you mean with *complex joins*?
>  
>

SELECT first, last, username || '@' || dom.domain as emailaddress
  FROM cust_main cm
   LEFT OUTER JOIN cust_pkg    cp ON ( cm.custnum = cp.custnum )
   LEFT OUTER JOIN cust_svc    cs ON ( cp.pkgnum  = cs.pkgnum )
   LEFT OUTER JOIN svc_email   em ON ( cs.svcnum  = em.svcnum )
   LEFT OUTER JOIN svc_domain dom ON ( em.domain  = dom.svcnum )
  WHERE zip = '99999'
    AND username || '@' || dom.domain != '@'

Which worked until I added one more table with a one-to-one relation to 
cust_main.custnum.  Then I got several tuples (2+) for each row above.


Rod
-- 

---
[This E-mail scanned for viruses by Declude Virus]


In response to

Responses

pgsql-admin by date

Next:From: Christian FowlerDate: 2004-11-24 06:32:37
Subject: Re: joins INNER, OUTER, LEFT, RIGHT, FULL, ...
Previous:From: Vincent ChenDate: 2004-11-24 05:30:06
Subject: Re: hardware to get best performance

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group