pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gerardo Herzig <gherzig@fmed.uba.ar>
To: pgsql-sql@postgresql.org
Subject: Re: an aggregate to return max() - 1 value?
Date: Thu, 04 Mar 2010 17:14:00 -0300
Message-ID: <4B901488.6080502@fmed.uba.ar> (raw)
In-Reply-To: <20100304200913.GA24865@apartia.fr>
References: <20100304200913.GA24865@apartia.fr>

Louis-David Mitterrand wrote:
> Hi,
> 
> With builtin aggregates is it possible to return the value just before
> max(col)?
> 
> Thanks,
> 
Mmmm what about
select max(col) from table where col not in (select max(col) from table;
? Looks like a double table reading, but it works.

Gerardo



view thread (6+ messages)  latest in thread

Message-ID: <4B901488.6080502@fmed.uba.ar>
Permalink:  ../4B901488.6080502@fmed.uba.ar/
Also on:    postgresql.org/message-id/4B901488.6080502@fmed.uba.ar

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: gherzig@fmed.uba.ar
  Subject: Re: an aggregate to return max() - 1 value?
  In-Reply-To: <4B901488.6080502@fmed.uba.ar>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox