From: Roderick A. Anderson <raa@mailporter.net>
To: Jaime Casanova <systemguards@yahoo.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: joins INNER, OUTER, LEFT, RIGHT, FULL, ...
Date: Tue, 23 Nov 2004 21:32:45 -0800
Message-ID: <41A41CFD.1020109@mailporter.net> (raw)
In-Reply-To: <20041124050641.86985.qmail@web50004.mail.yahoo.com>
References: <20041124050641.86985.qmail@web50004.mail.yahoo.com>
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]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: raa@mailporter.net, systemguards@yahoo.com
Subject: Re: joins INNER, OUTER, LEFT, RIGHT, FULL, ...
In-Reply-To: <41A41CFD.1020109@mailporter.net>
References: <20041124050641.86985.qmail@web50004.mail.yahoo.com> <41A41CFD.1020109@mailporter.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox