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]
---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly