X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A0947D82D0 for ; Thu, 25 Aug 2005 12:06:49 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 04906-10 for ; Thu, 25 Aug 2005 15:06:47 +0000 (GMT) Received: from localhost.localdomain (unknown [12.31.43.201]) by svr1.postgresql.org (Postfix) with ESMTP id 04490D81AC for ; Thu, 25 Aug 2005 12:06:44 -0300 (ADT) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.13.1/8.13.1) with ESMTP id j7PF6k2e004119 for ; Thu, 25 Aug 2005 11:06:47 -0400 Received: from localhost (localhost [[UNIX: localhost]]) by localhost.localdomain (8.13.1/8.13.1/Submit) id j7PF6jkR004118 for pgsql-sql@postgresql.org; Thu, 25 Aug 2005 11:06:45 -0400 From: "Mark R. Dingee" To: pgsql-sql@postgresql.org Subject: Re: Can EXCEPT Be Used for To Solve This Problem? Date: Thu, 25 Aug 2005 11:06:40 -0400 User-Agent: KMail/1.8.2 References: <6A9A99AA-E7AF-4922-8B79-75A370582E63@khera.org> In-Reply-To: <6A9A99AA-E7AF-4922-8B79-75A370582E63@khera.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200508251106.41540.mark.dingee@cox.net> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.263 required=5 tests=[AWL=-0.229, DNS_FROM_RFC_WHOIS=0.492] X-Spam-Level: X-Archive-Number: 200508/243 X-Sequence-Number: 22471 you can also do select ... order by update_time desc offset 1 limit 1 On Thursday 25 August 2005 10:47 am, Vivek Khera wrote: > On Aug 24, 2005, at 4:47 PM, Lane Van Ingen wrote: > > I want to select 2nd oldest transaction from foo (transaction 3). The > > solution below > > works, but I think there may be a better way. Does anyone else have > > a better > > idea? > > why not just select order by update_time desc limit 2 then discard > the first row you fetch? > > > Vivek Khera, Ph.D. > +1-301-869-4449 x806 > > > > ---------------------------(end of broadcast)--------------------------- > TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match