From: | "Marc Rohloff" <Marc(dot)Rohloff(at)eskom(dot)co(dot)za> |
---|---|
To: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | Outer Joins |
Date: | 2000-11-01 08:02:22 |
Message-ID: | s9ffea47.097@eskom.co.za |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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
From | Date | Subject | |
---|---|---|---|
Next Message | pgsql-sql | 2000-11-01 09:34:26 | Re(2): Large Object dump ? |
Previous Message | cn | 2000-11-01 03:17:52 | How To Increment A Field Value By Function |