From: | "Jackson, DeJuan" <djackson(at)cpsgroup(dot)com> |
---|---|
To: | Frans de Wet <Frans(at)Playful(dot)com>, pgsql-sql(at)postgreSQL(dot)org |
Subject: | RE: [SQL] Retrieving the record not matched with a join. |
Date: | 1999-03-31 21:06:00 |
Message-ID: | D05EF808F2DFD211AE4A00105AA1B5D2037F87@cpsmail |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Try:
SELECT * FROM A
WHERE NOT EXISTS(SELECT 1 FROM B WHERE A.BID = B.BID);
-DEJ
> Hi,
>
> I have two tables, A and B. A contains records which
> includes an ID or one
> of the records in table B.
>
> A would typically contain the fields:
>
> IDA
> IDB
> DATA1
> DATA2
>
> and B:
>
> IDB
> DATA3
> DATA4
>
> I have several records in both but a few of the records in A
> has a IDB field
> which does not point to a valid record in B (the record has
> been deleted).
>
> I know how to get all the records in A that have existing
> records in B.
> SELECT * FROM A, B WHERE A.BID = B.BID.
>
> Now my question ... How do I get the records in A that DO NOT
> have existing
> records in B ???
>
> Perplexed look and deep frown ;-)
>
> Thanks in Advance
> Frans
From | Date | Subject | |
---|---|---|---|
Next Message | Richi Plana | 1999-04-01 00:57:54 | Finding strange patters |
Previous Message | Frans de Wet | 1999-03-31 20:53:49 | Retrieving the record not matched with a join. |