From: Gerhard Dieringer <DieringG@eba-haus.de>
To: " <Antti Linno" <alligator@all.ee>
Cc: pgsql-sql@postgresql.org
Subject: Antw: LEFT JOIN
Date: Tue, 04 Jul 2000 14:46:18 +0200
Message-ID: <s961f8c0.049@kopo001> (raw)
Antti Linno wrote:
> Greetings.
> I have a problem. I have 2 tables. E.g. work and workers. I want to
> select records, that 1st table has, and the second hasn't(both have id
> attribute). I mean I can't do it with is NULL, because those records don't
> exist. I was shown, how it is done with mysql
I think, the following select will solve your problem
select first.id
from first
except
second.id_first
from second;
>
> select first.id,second.id_first
> from first left join second on
> id=id_first where id_first is NULL;
>
This query should never give any result, because you require
id_first = id and id_first is null
but if id_first is null then it's equal to nothing,
and BTW it's also unequal to nothing.
> but when I tried it in psql, it said, not implemented.
Outer joins (left or right joins) are not implemented in PostgreSQL 7.0, but will
come in 7.1.
>
> Antti
Gerhard
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: DieringG@eba-haus.de, Antti Linno" <alligator@all.ee
Subject: Re: LEFT JOIN
In-Reply-To: <s961f8c0.049@kopo001>
References: <s961f8c0.049@kopo001>
* 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