pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Denis Sbragion <sbragion.denis@usa.net>
To: Ken J. Wright <ken@ori-ind.com>
To: pgsql-interfaces@postgreSQL.org
Subject: Re: [INTERFACES] outer joins
Date: Mon, 08 Mar 1999 09:02:21 +0100
Message-ID: <3.0.6.32.19990308090221.00b3bb10@MBox.InfoTecna.com> (raw)
In-Reply-To: <3.0.32.19990307190027.00889d20@ren.cncware.com>

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



view thread (2+ messages)

Message-ID: <3.0.6.32.19990308090221.00b3bb10@MBox.InfoTecna.com>
Permalink:  ../3.0.6.32.19990308090221.00b3bb10@MBox.InfoTecna.com/
Also on:    postgresql.org/message-id/3.0.6.32.19990308090221.00b3bb10@MBox.InfoTecna.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: sbragion.denis@usa.net, ken@ori-ind.com
  Subject: Re: [INTERFACES] outer joins
  In-Reply-To: <3.0.6.32.19990308090221.00b3bb10@MBox.InfoTecna.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox