Re: Help with Outer Joins

From: "Josh Berkus" <josh(at)agliodbs(dot)com>
To: Sharon Cowling <sharon(dot)cowling(at)sslnz(dot)com>, pgsql-novice(at)postgresql(dot)org
Subject: Re: Help with Outer Joins
Date: 2001-11-14 21:34:59
Message-ID: web-506106@davinci.ethosmedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Sharon,

> I come from an Oracle background and have noted that postgres 7.1
> supports outer joins...but I'm not sure of the syntax. Note below in
> the first AND clause the (+) next to k.permit_id, I need to get the
> nulls back as well as the value but I get an error when I use (+)

The (+) method of performing outer joins is an Oracle proprietary
deviation from the SQL92 standard. No other database uses this.

The PostgreSQL, and SQL92 standard, method for performing outer joins is
to use and explicit join syntax:

SELECT *
FROM table_a LEFT OUTER JOIN table_b
ON table_a.1 = table_b.2

Please be careful using LEFT and RIGHT outer joins to get the joined
tables on the correct sides!

See:
http://www.postgresql.org/idocs/index.php?sql-select.html
for more information on JOIN syntax.

see:
http://techdocs.postgresql.org/
for articles on porting from Oracle to Postgres

-Josh

______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh(at)agliodbs(dot)com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message tvahakan 2001-11-15 12:28:52 PostgreSQL performance deteriorates over time?
Previous Message Frank Hilliard 2001-11-14 18:04:16 PHP GUI?