Re: Questions about Exists-Not exists clause

From: Nabil Sayegh <postgresql(at)e-trolley(dot)de>
To: papapep <papapep(at)gmx(dot)net>
Cc: pgsql-novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Questions about Exists-Not exists clause
Date: 2003-07-24 13:03:37
Message-ID: 1059051817.8539.2.camel@billy
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Am Don, 2003-07-24 um 13.30 schrieb papapep:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> I've got, imagine, the next two tables:
>
> table A:
>
> field1 char(3)
> field2 varchar(50)
> field3 numeric(6)
>
>
> table B:
>
> field4 date
> field5 time
> field6 numeric(6)
>
>
> I need to know which rows in table A are not in table B, and the join
> fields are the two numeric ones (field3 and field6).

SELECT * FROM A WHERE NOT EXISTS (SELECT NULL FROM B WHERE
A.field3=B.field6);

>
> I've been taking a look at the EXISTS statement, but I can't see how I
> should do it.
>
> Some advice??
> Thanks in advance.

np
--
e-Trolley Sayegh & John, Nabil Sayegh
Tel.: 0700 etrolley /// 0700 38765539
Fax.: +49 69 8299381-8
PGP : http://www.e-trolley.de

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Dag Gullberg 2003-07-24 13:17:35 question about images
Previous Message William Yu 2003-07-24 11:40:07 Re: Locking tables