Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 9EFD7632AAD for ; Thu, 4 Mar 2010 16:09:27 -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 60280-07 for ; Thu, 4 Mar 2010 20:09:17 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sargon.lncsa.com (mail.lncsa.com [213.215.28.11]) by mail.postgresql.org (Postfix) with ESMTP id 3419D6326EB for ; Thu, 4 Mar 2010 16:09:17 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by sargon.lncsa.com (Postfix) with ESMTP id 084F5301E6E7 for ; Thu, 4 Mar 2010 21:09:15 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at lncsa.com Received: from sargon.lncsa.com ([127.0.0.1]) by localhost (sargon.lncsa.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CKJUddsEAG-F for ; Thu, 4 Mar 2010 21:09:14 +0100 (CET) Received: from zenon.apartia.fr (zenon.apartia.fr [10.0.3.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "zenon.apartia.fr", Issuer "ca.apartia.fr" (verified OK)) by sargon.lncsa.com (Postfix) with ESMTP id DD419301E6E6 for ; Thu, 4 Mar 2010 21:09:14 +0100 (CET) Received: from delos.apartia.fr (delos.apartia.fr [10.0.3.107]) by zenon.apartia.fr (Postfix) with ESMTP id 968A95B93F8FC for ; Thu, 4 Mar 2010 21:09:14 +0100 (CET) Received: by delos.apartia.fr (Postfix, from userid 1000) id 4B7D12002C04F; Thu, 4 Mar 2010 21:09:14 +0100 (CET) Date: Thu, 4 Mar 2010 21:09:14 +0100 From: Louis-David Mitterrand To: pgsql-sql@postgresql.org Subject: an aggregate to return max() - 1 value? Message-ID: <20100304200913.GA24865@apartia.fr> Mail-Followup-To: pgsql-sql@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) 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/29 X-Sequence-Number: 33736 Hi, With builtin aggregates is it possible to return the value just before max(col)? Thanks,