pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jasen Betts <jasen@xnet.co.nz>
To: pgsql-sql@postgresql.org
Subject: Re: self join
Date: 15 May 2011 02:36:46 GMT
Message-ID: <iqne7u$ssa$2@reversiblemaps.ath.cx> (raw)
References: <87y629rl34.fsf@kolob.subpolar.dyndns.org>

On 2011-05-14, Seb <spluque@gmail.com> wrote:
> Hi,
>
> This probably reflects my confusion with how self joins work.
>
> Suppose we have this table:

> If I want to get a table with records where none of the values in column
> b are found in column a, I thought this should do it:

use the "NOT IN" operator with a subquery to retch the disallowed
values.

select * from tmp where a NOT IN (select b from tmp);

-- 
⚂⚃ 100% natural




view thread (15+ messages)  latest in thread

Message-ID: <iqne7u$ssa$2@reversiblemaps.ath.cx>
Permalink:  ../iqne7u$ssa$2@reversiblemaps.ath.cx/
Also on:    postgresql.org/message-id/iqne7u$ssa$2@reversiblemaps.ath.cx

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: jasen@xnet.co.nz
  Subject: Re: self join
  In-Reply-To: <iqne7u$ssa$2@reversiblemaps.ath.cx>

* 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