Re: Get the max(value1, value2, value3) from a table

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "Josh Williams" <joshwilliams(at)ij(dot)net>
Cc: emilu(at)encs(dot)concordia(dot)ca, pgsql-sql(at)postgresql(dot)org
Subject: Re: Get the max(value1, value2, value3) from a table
Date: 2008-01-07 22:43:27
Message-ID: dcc563d10801071443g3c91a29sd27ce5bdf6c4652b@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Jan 7, 2008 4:38 PM, Josh Williams <joshwilliams(at)ij(dot)net> wrote:
> On Mon, 2008-01-07 at 17:03 -0500, Emi Lu wrote:
> > select ?max?(col1, col2, col3) as result;
> > will return
> >
> > result
> > -------
> > 5
> > 8
> > 12
> >
> > (3 rows)
>
> 8.1 (I believe?) introduced GREATEST(), which does precisely what you're
> looking for.

How would greatest give him three rows like that? Maybe I'm
misunderstanding what the OP was asking for...

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Emi Lu 2008-01-07 22:53:26 Re: Get the max(value1, value2, value3) from a table
Previous Message Scott Marlowe 2008-01-07 22:40:04 Re: Get the max(value1, value2, value3) from a table