Re: finding records not listed in a column, Postgresql - Mailing list pgsql-novice

From Bruno Wolff III
Subject Re: finding records not listed in a column, Postgresql
Date
Msg-id 20030427153618.GA26384@wolff.to
Whole thread Raw
In response to finding records not listed in a column, Postgresql  (Aaron Payne <apayneinc@yahoo.com>)
List pgsql-novice
On Sun, Apr 27, 2003 at 08:02:16 -0700,
  Aaron Payne <apayneinc@yahoo.com> wrote:
> Hi,
>
> I need the records in table A in which the values in
> A.objectID are not listed in B.objectID.  I'm such a
> noob that I'm not sure of the terms I need to use for
> this statement.
>
> table A
> rows: person_id, objectID
>
> table B
> rows: id, objectID

Below are two ways of doing this. If A.objectID and B.objectID can both
be NULL, the records in A with NULL values won't be excluded.

select * from A
   where not exists (select 1 from B where A.objectID = B.objectID);

select A.person_id, A.objectID from A right join B using (objectID)
  where B.objectID is null;


pgsql-novice by date:

Previous
From: Paul Makepeace
Date:
Subject: Re: finding records not listed in a column, Postgresql
Next
From: Tom Lane
Date:
Subject: Re: finding records not listed in a column, Postgresql