Re: Outer Joins

From: Martín Marqués <martin(at)bugs(dot)unl(dot)edu(dot)ar>
To: Sharon Cowling <sharon(dot)cowling(at)sslnz(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Outer Joins
Date: 2001-11-13 11:31:20
Message-ID: 20011113113123.1D0072AB3F@bugs.unl.edu.ar
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mar 13 Nov 2001 01:43, Sharon Cowling wrote:
> 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 (+)
>
> SELECT t.permit_id, t.issue_date, t.issued_by, t.location, t.purpose ||'
> '|| t.subpurpose as spurpose, t.date_from, t.date_to, t.permit_conditions,
> t.other_info, k.key_code, p.person_id, p.firstname ||' '|| p.lastname as
> name FROM person p, forest_permit t, permit_key k

FROM erson p, (forest_permit t {LEFT|RIGHT} OUTER JOIN permit_key k ON
(t.permit_id = k.permit_id))

Change that, and eliminate the WHERE cluse with th + sign.

> WHERE p.person_id = t.person_id
> AND t.permit_id = k.permit_id(+)
> AND p.lastname LIKE 'Bloggs'
> AND p.firstname LIKE 'Joe'
> ORDER BY t.issue_date

Saludos... :-)

--
Porqué usar una base de datos relacional cualquiera,
si podés usar PostgreSQL?
-----------------------------------------------------------------
Martín Marqués | mmarques(at)unl(dot)edu(dot)ar
Programador, Administrador, DBA | Centro de Telematica
Universidad Nacional
del Litoral
-----------------------------------------------------------------

In response to

  • Outer Joins at 2001-11-13 04:43:00 from Sharon Cowling

Browse pgsql-general by date

  From Date Subject
Next Message Justin Clift 2001-11-13 12:04:40 Re: Is data storage secure?
Previous Message Carl van Tast 2001-11-13 10:15:52 Re: What's the fastest way to do this?