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 009BA9FA612 for ; Fri, 30 Jun 2006 19:49:42 -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 30532-07 for ; Fri, 30 Jun 2006 19:49:38 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from web31813.mail.mud.yahoo.com (web31813.mail.mud.yahoo.com [68.142.207.76]) by postgresql.org (Postfix) with SMTP id 626F79FA506 for ; Fri, 30 Jun 2006 19:49:37 -0300 (ADT) Received: (qmail 41932 invoked by uid 60001); 30 Jun 2006 22:49:36 -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=SezubVWChTs13FsMrk0Kc94+xf7EEMykEDWHGX+YclqiKzpEi940lOWUWHT+R38ymKpiLDbqBblQ3yIEIzIYgJ8S2qa3Y3Wx1FqCrVoIYWKoJH2uVEhfaLu9SU9bunRJ2oBKAj9C85DC6mS+6JiTxeEue3nQbUdb6UZ8CPAZiLQ= ; Message-ID: <20060630224936.41930.qmail@web31813.mail.mud.yahoo.com> Received: from [24.54.196.198] by web31813.mail.mud.yahoo.com via HTTP; Fri, 30 Jun 2006 15:49:36 PDT Date: Fri, 30 Jun 2006 15:49:36 -0700 (PDT) From: Richard Broersma Jr Subject: Re: How To Exclude True Values To: Richard Broersma Jr , operationsengineer1@yahoo.com, "pgsql-sql@postgresql.org" In-Reply-To: <20060606234031.168.qmail@web31807.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/336 X-Sequence-Number: 25572 > Also, I produced a second query using PostgreSQL: > select a.id_i, a.ir_id, a.test, a.stamp > from test a > join > ( > select max(stamp) as mstamp, id_i > from test > group by id_i > ) b > on a.stamp = b.mstamp > where a.test = false > ; > -- result > id_i | ir_id | test | stamp > ------+-------+------+--------------------- > 4 | 8 | f | 2006-06-05 08:00:00 I found this query produced the same result. It is a list slower than the first with my small dataset. but maybe it will improve for larger datasets? select t1.id_i, t1.ir_id, t1.test, t1.stamp, t1.inttest from test as t1 where t1.stamp = ( select max(T2.stamp) from test as t2 where t2.id_i = t1.id_i) and t1.test = 'f'; Regards, Richard Broersma Jr.