Re: Help with Outer Joins - Mailing list pgsql-novice

From Josh Berkus
Subject Re: Help with Outer Joins
Date
Msg-id web-506106@davinci.ethosmedia.com
Whole thread Raw
In response to Help with Outer Joins  (Sharon Cowling <sharon.cowling@sslnz.com>)
List 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@agliodbs.com
   and data management solutions       (415) 565-7293
  for law firms, small businesses        fax 621-2533
    and non-profit organizations.      San Francisco

pgsql-novice by date:

Previous
From: Sharon Cowling
Date:
Subject: Help with Outer Joins
Next
From: tvahakan@fw.cluster.net
Date:
Subject: PostgreSQL performance deteriorates over time?