pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Milen A. Radev <milen@radev.net>
To: pgsql-sql@postgresql.org
Subject: Re: How to find entries missing in 2nd table?
Date: Tue, 11 Jul 2006 19:57:20 +0300
Message-ID: <44B3D870.1090409@radev.net> (raw)
In-Reply-To: <20060711155201.22418.qmail@web31810.mail.mud.yahoo.com>
References: <20060711141951.GA17936@s2.yuriev.com>
	<20060711155201.22418.qmail@web31810.mail.mud.yahoo.com>

Richard Broersma Jr написа:
>> Hi,
>> 	I realize I probably lost my marbles but I've been having a god
>> awful time with a single query:
>>
>> control:
>> 	....
>> 	....
>> 	controller_id	pk;
>>
>>
>> datapack:
>>
>> 	controller_id	fk;
>> 	....
>> 	....
>> 	....
>>
>> I need to get all entries from the table control that are not listed in
>> datapack.
> 
> SELECT C.CONTROLLER_ID
> 
> FROM CONTROL AS C 
>   LEFT JOIN DATAPACK AS D ON ( C.CONTROLLER_ID = D.CONTROLLER_ID)
> 
> WHERE D.CONTROLLER_ID IS NULL;
> 


Or
(SELECT controller_id FROM control)
EXCEPT
(SELECT controller_id FROM datapack)
?

-- 
Milen A. Radev




view thread (13+ messages)  latest in thread

Message-ID: <44B3D870.1090409@radev.net>
Permalink:  ../44B3D870.1090409@radev.net/
Also on:    postgresql.org/message-id/44B3D870.1090409@radev.net

 · 

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: milen@radev.net
  Subject: Re: How to find entries missing in 2nd table?
  In-Reply-To: <44B3D870.1090409@radev.net>

* 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