Re: [INTERFACES] outer joins

From: Denis Sbragion <sbragion(dot)denis(at)usa(dot)net>
To: "Ken J(dot) Wright" <ken(at)ori-ind(dot)com>, pgsql-interfaces(at)postgreSQL(dot)org
Subject: Re: [INTERFACES] outer joins
Date: 1999-03-08 08:02:21
Message-ID: 3.0.6.32.19990308090221.00b3bb10@MBox.InfoTecna.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Hello,

At 19.00 07/03/99 -0800, you wrote:
>So, is there an eloquent (or not) way to fake an outer join in PostgreSQL?

yes! Example of a workaround using unions:

select
X.a, X.b,
Y.a, Y.b
from
X left outer join Y on X.a = Y.a

becomes

select
X.a, X.b,
Y.a, Y.b
from
X,Y
where
X.a = Y.a
union
select
X.a, X.b,
null, null
from
X
where
not exists (select * from Y where Y.a = X.a)

Little cumbersome but it works.

Bye!

Sbragion Denis
InfoTecna
Tel, Fax: +39 039 2324054
URL: http://space.tin.it/internet/dsbragio

In response to

  • outer joins at 1999-03-08 03:00:29 from Ken J. Wright

Browse pgsql-interfaces by date

  From Date Subject
Next Message Ken J. Wright 1999-03-08 08:11:39 Re: [INTERFACES] copy command & null datetime
Previous Message Michael Meskes 1999-03-08 07:46:47 Re: [INTERFACES] Counting updates with libpq