pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: jack <datactrl@tpg.com.au>
To: pgsql-sql@postgresql.org
Subject: the best way to get some records not in another table
Date: Tue, 18 Mar 2003 21:17:03 +1000
Message-ID: <002c01c2ed3f$e7fee740$1400a8c0@jac> (raw)

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




view thread (3+ messages)  latest in thread

Message-ID: <002c01c2ed3f$e7fee740$1400a8c0@jac>
Permalink:  ../002c01c2ed3f$e7fee740$1400a8c0@jac/
Also on:    postgresql.org/message-id/002c01c2ed3f$e7fee740$1400a8c0@jac

 · 

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: datactrl@tpg.com.au
  Subject: Re: the best way to get some records not in another table
  In-Reply-To: <002c01c2ed3f$e7fee740$1400a8c0@jac>

* 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