pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
outer joins
2+ messages / 2 participants
[nested] [flat]

* outer joins
@ 1999-03-08 03:00  Ken J. Wright <ken@ori-ind.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Ken J. Wright @ 1999-03-08 03:00 UTC (permalink / raw)
  To: pgsql-interfaces

So, is there an eloquent (or not) way to fake an outer join in PostgreSQL?

Ken




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [INTERFACES] outer joins
@ 1999-03-08 08:02  Denis Sbragion <sbragion.denis@usa.net>
  parent: Ken J. Wright <ken@ori-ind.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Denis Sbragion @ 1999-03-08 08:02 UTC (permalink / raw)
  To: Ken J. Wright <ken@ori-ind.com>; 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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~1999-03-08 08:02 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-03-08 03:00 outer joins Ken J. Wright <ken@ori-ind.com>
1999-03-08 08:02 ` Denis Sbragion <sbragion.denis@usa.net>

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