Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 9997C633D79 for ; Fri, 5 Mar 2010 02:33:13 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 67689-01 for ; Fri, 5 Mar 2010 06:33:03 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wy0-f174.google.com (mail-wy0-f174.google.com [74.125.82.174]) by mail.postgresql.org (Postfix) with ESMTP id 081F063328A for ; Fri, 5 Mar 2010 02:33:02 -0400 (AST) Received: by wya21 with SMTP id 21so1889411wya.19 for ; Thu, 04 Mar 2010 22:33:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=NJ56e5BI1sktJbkqE9Jk1HbVKNoRu/r6tshOOA4zdXU=; b=eeaYVwd9NJGmrd1/rH+TlhGOqmdin9rOdU534HtR2JQjW59Vg9xLITyn2J/mO9iJbM UvGEFHIFgsL/WD4OJAiUuEWLW5SC3Pgr3e5UDEKjttEpkJEVx9XMLvX1v/2v58oWE+7r csxYwOLbKBq5Fc2Dg8hMkqaPdvokd5ZvHlIyE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=SOEFlh3qIz98ZpnHp3L365mrYk0uaNx1wLmye++Tr5UD1KnrZTQ7Kf8UPJDd1cbSWr bULkuuQ1AFWrrGdCnCIAA2Lgcz6RDkIwP52vQkebXcEJtIwqsrlulh+fMhCKLDiLy2s5 rKLyFiNmIsLq7RtnxVPGS3kkYuKpn2+zWu05Y= MIME-Version: 1.0 Received: by 10.216.87.130 with SMTP id y2mr135695wee.51.1267770781762; Thu, 04 Mar 2010 22:33:01 -0800 (PST) In-Reply-To: <20100304200913.GA24865@apartia.fr> References: <20100304200913.GA24865@apartia.fr> Date: Fri, 5 Mar 2010 07:33:01 +0100 Message-ID: <162867791003042233u5175ecd4u448cd1ae198e08ce@mail.gmail.com> Subject: Re: an aggregate to return max() - 1 value? From: Pavel Stehule To: pgsql-sql@postgresql.org Content-Type: text/plain; charset=UTF-8 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201003/33 X-Sequence-Number: 33740 Hello select min(x) from (select x from data order by x desc limit 2) s; Pavel 2010/3/4 Louis-David Mitterrand : > Hi, > > With builtin aggregates is it possible to return the value just before > max(col)? > > Thanks, > > -- > Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-sql >