X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 54CAD9FB1CE for ; Tue, 11 Jul 2006 12:52:07 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 76607-04 for ; Tue, 11 Jul 2006 12:52:03 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from web31810.mail.mud.yahoo.com (web31810.mail.mud.yahoo.com [68.142.207.73]) by postgresql.org (Postfix) with SMTP id 91B1E9FB1B9 for ; Tue, 11 Jul 2006 12:52:02 -0300 (ADT) Received: (qmail 22420 invoked by uid 60001); 11 Jul 2006 15:52:01 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=2DQ2tEP2yk9jhiX+pP4afDAdySlVEPRe92HQSHmZjPoq8B2DxkGcqSJGLStBrqhD9hodrMCE1ugJ2WxfGtnfARYuDO/vaJygWrYpSB3Y+mU1GUIiwF5xtnb6h0W/NsMMOo2hJ0RtG7Cm8uShie50PA4uAow2Lgkx43X4nih6fg4= ; Message-ID: <20060711155201.22418.qmail@web31810.mail.mud.yahoo.com> Received: from [63.203.180.122] by web31810.mail.mud.yahoo.com via HTTP; Tue, 11 Jul 2006 08:52:01 PDT Date: Tue, 11 Jul 2006 08:52:01 -0700 (PDT) From: Richard Broersma Jr Subject: Re: How to find entries missing in 2nd table? To: pgsql-sql@postgresql.org In-Reply-To: <20060711141951.GA17936@s2.yuriev.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200607/180 X-Sequence-Number: 25754 > 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; Regards, Richard Broersma Jr.