pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Marc Rohloff <Marc.Rohloff@eskom.co.za>
To: pgsql-sql@postgresql.org
Subject: Outer Joins
Date: Wed, 01 Nov 2000 10:02:22 +0200
Message-ID: <s9ffea47.097@eskom.co.za> (raw)

I've been looking at the open-source databases for a project I am working on and while reading about Postgres I saw that they do not support outer joins yet. I was intrigued by their solution of using a union query.

Something Like:
select a.col1, b.col2 from a,b where a.col1 = b.col2
union
select a.col1, NULL from a where a.col1 not in (select b.col2 from b)

But I was wondering if the following would work (it does in some other databases)

select a.col1, b.col2 from a,b 
where a.col1 = b.col2
   or  b.col2 is null

or maybe even

select a.col1, b.col2 from a,b 
where a.col1 = b.col2
   or  a.col1 not in (select b.col2 from b)

These would seem to be far more efficient than a union query
(I would try this but I don't have a Unix box at the moment to install PostgreSQL on!)

Marc Rohloff







view thread (38+ messages)  latest in thread

Message-ID: <s9ffea47.097@eskom.co.za>
Permalink:  ../s9ffea47.097@eskom.co.za/
Also on:    postgresql.org/message-id/s9ffea47.097@eskom.co.za

 · 

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-sql@postgresql.org
  Cc: Marc.Rohloff@eskom.co.za
  Subject: Re: Outer Joins
  In-Reply-To: <s9ffea47.097@eskom.co.za>

* 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