the best way to get some records not in another table

From: "jack" <datactrl(at)tpg(dot)com(dot)au>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: the best way to get some records not in another table
Date: 2003-03-18 11:17:03
Message-ID: 002c01c2ed3f$e7fee740$1400a8c0@jac
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi, all

Try to get some records not in another table. As the following, please
advise which one will be the best way to do. Or is there any other way to do
better?

SELECT DISTINCT a.c1
FROM test_j2 a
WHERE a.c1 NOT IN (SELECT DISTINCT b.c1 FROM test_j1 b);

SELECT a.c1 FROM test_j2 a
EXCEPT
SELECT b.c1 FROM test_j1 b;

Jack

Browse pgsql-sql by date

  From Date Subject
Next Message Christoph Haller 2003-03-18 11:36:40 Re: Min values?
Previous Message Tatsuo Ishii 2003-03-18 08:37:15 Re: PLPGSQL with Multibyte Issue