X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id BA2F79FA4D8 for ; Mon, 5 Jun 2006 23:36:27 -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 30944-07 for ; Mon, 5 Jun 2006 23:36:20 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from web31815.mail.mud.yahoo.com (web31815.mail.mud.yahoo.com [68.142.206.168]) by postgresql.org (Postfix) with SMTP id AD15C9F9316 for ; Mon, 5 Jun 2006 23:36:19 -0300 (ADT) Received: (qmail 18397 invoked by uid 60001); 6 Jun 2006 02:36:18 -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=bSm9wbwh7OSq65nOWMUyv8m83voOAq5V4VjaDJQXmA9lCWRjTF7FAONKhs0tgMT3Dj2MgVzcX9dVjtAZmuKhkLAHsdMV/c1A2641viukx/yVCiYUTugbO4q7hfAdypF8c3vWVhliBnal9uYP90ifw9iq1YiF2UGNYL8cgpYfjqI= ; Message-ID: <20060606023618.18392.qmail@web31815.mail.mud.yahoo.com> Received: from [68.235.218.116] by web31815.mail.mud.yahoo.com via HTTP; Mon, 05 Jun 2006 19:36:18 PDT Date: Mon, 5 Jun 2006 19:36:18 -0700 (PDT) From: Richard Broersma Jr Subject: Re: How To Exclude True Values To: operationsengineer1@yahoo.com, "pgsql-sql@postgresql.org" In-Reply-To: <20060606020714.61758.qmail@web33304.mail.mud.yahoo.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: 200606/57 X-Sequence-Number: 25293 > > how can i exclude true values for this query? > > > > http://www.rafb.net/paste/results/obtkGz26.html > > > > if i uncomment out > > > > -- AND t_inspect_result.inspect_result_pass = 'f' > > > > it looks for prior falses within an inspect_id and > > returns it. i want the original result set minus > > the > > trues, if possible. > > > > tia... > > this SQL appears to do the trick... > > http://www.rafb.net/paste/results/zZKIjH80.html I have one idea that hopefully wont complicate you query but it could simplfy your query by getting rid of the query nexting. Also, I haven't tested it. Basically, Replace the DISTINCT ON (t_inspect.inspect_id) construct with GROUP BY t_inspect.inspect_id HAVING t_inspect_result.inspect_result_pass = 'f' Regards, Richard Broersma Jr.