pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Brook Milligan <brook@trillium.NMSU.Edu>
To: djackson@cpsgroup.com
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] finding rows in one table not in another
Date: Fri, 12 Jun 1998 16:50:14 -0600 (MDT)
Message-ID: <199806122250.QAA00571@trillium.nmsu.edu> (raw)
In-Reply-To: <F10BB1FAF801D111829B0060971D839F2D7ED4@cpsmail>
References: <F10BB1FAF801D111829B0060971D839F2D7ED4@cpsmail>

   > I need to find the set of rows in one table that are not in another
   > table.  I used a query like the following:
   > 
   > 	select distinct id from mytable1 where id not in (select
   > distinct id from mytable2);
   > 
   try:
	   SELECT mytable1.id 
	FROM mytable1 
       WHERE NOT EXIST (SELECT mytable2.id
			  FROM mytable2
			 WHERE mytable1.id = mytable2.id);

Thanks.  That works except it should be EXISTS (i.e., plural).

Cheers,
Brook





view thread (4+ messages)  latest in thread

Message-ID: <199806122250.QAA00571@trillium.nmsu.edu>
Permalink:  ../199806122250.QAA00571@trillium.nmsu.edu/
Also on:    postgresql.org/message-id/199806122250.QAA00571@trillium.nmsu.edu

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: brook@trillium.NMSU.Edu, djackson@cpsgroup.com
  Subject: Re: [SQL] finding rows in one table not in another
  In-Reply-To: <199806122250.QAA00571@trillium.nmsu.edu>
  References: <F10BB1FAF801D111829B0060971D839F2D7ED4@cpsmail> <199806122250.QAA00571@trillium.nmsu.edu>

* 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