Re: Problem with "NOT IN (subquery) - use NOT EXISTS

From: chester c young <chestercyoung(at)yahoo(dot)com>
To: Steve SAUTETNER <steve(at)sautetner(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Problem with "NOT IN (subquery) - use NOT EXISTS
Date: 2005-11-13 17:07:01
Message-ID: 20051113170701.47847.qmail@web54314.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

--- Steve SAUTETNER <steve(at)sautetner(dot)com> wrote:
> SELECT * FROM famille WHERE famille_code NOT IN
> (SELECT DISTINCT famille_mere_famille_code FROM famille);"

try
select * from famille f1 where not exists
(select 1 from famille f2
where f1.famille_code = f2.famille_mere_famille_code);

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Bath, David 2005-11-14 02:08:06 selective dump pg_dump: only specific non-tables? with schema name?
Previous Message Stephan Szabo 2005-11-13 09:16:18 Re: Problem with "NOT IN (subquery)