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 EC0CC9FB1B9 for ; Tue, 6 Jun 2006 15:56:44 -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 41527-08 for ; Tue, 6 Jun 2006 15:56:40 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from web33309.mail.mud.yahoo.com (web33309.mail.mud.yahoo.com [68.142.206.124]) by postgresql.org (Postfix) with SMTP id 61B219FA13E for ; Tue, 6 Jun 2006 15:56:41 -0300 (ADT) Received: (qmail 4575 invoked by uid 60001); 6 Jun 2006 18:56:39 -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=hhl2/8qZi5dQI1WSV1j0GROnJBQssN3tZHn1Y4H2zWLLgf9KNvv4bjksavE0FWxig+V4e2Oyj9z9URVrxT8leByLciz5SrBiPoQVCWoMsJVTKAcrmovj+QyJWl869Ih/aKBjcZoSZk+/ai7HHrjlKWEWniVzutEW9K1xIbUdKj0= ; Message-ID: <20060606185639.4573.qmail@web33309.mail.mud.yahoo.com> Received: from [12.9.179.126] by web33309.mail.mud.yahoo.com via HTTP; Tue, 06 Jun 2006 11:56:39 PDT Date: Tue, 6 Jun 2006 11:56:39 -0700 (PDT) From: Subject: Re: How To Exclude True Values To: Richard Broersma Jr , "pgsql-sql@postgresql.org" In-Reply-To: <20060606173628.17134.qmail@web31815.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/72 X-Sequence-Number: 25308 > > inspect_id, inspect_result_id, > inspect_result_pass, > > inspect_result_timestamp > > 3, 5, f, 2006-06-05 05:00:00 > > 3, 6, t, 2006-06-05 06:00:00 > > 4, 7, f, 2006-06-05 07:00:00 > > *4, 8, f, 2006-06-05 08:00:00* > > the query linked in this post will return 3 > lines... > > > > 1, 2, f > > 3, 5, f > > *4, 8, f* -- the only one i really want > > > From your sample it seems to me that you are really > only looking for the most recient occuring > record that have produced a false test regardless of > which Inspect_id or inspect_result_id it came > from. Is this correct? Richard, not quite. i have an inspection entry form and a defect entry form. an inspection node (each row in t_inspect is an inspection node) that has passed can't have a new defect added - since it has already passed. therefore, in the defect entry form, i only want to display those inspection nodes that don't have a true value. by definition, a true value will always be the last (by time) inspect_result. therefore, i need all the inspect nodes that don't yet have a true value (iow, a true value in the last (by time) inspect_result_pass row). an inspection node can have multiple inspection results, hence, the t_inspection_results table. this might seem counter-intuitive at first, but it makes sense since it may take 5 tries to eventually pass a particular inspection node (f, f, f, f, t) for fucntional test, for example. one node, five tests to pass it. i went to this model b/c a unit can actually pass through the various test nodes multiple times. a unit might go through the same QA node three times - and i need to differentiate between these three QA nodes. if each inspection node only occurred once, i could use one table and link it a t_inspect_node table. due to the multiple passes, though, i can't do this in this case. i hope this makes sense. i'm living it and it is sometimes hard to keep straight. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com