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

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "Richard Broersma Jr" <rabroersma(at)yahoo(dot)com>
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:37:52
Message-ID: dcc563d10801071437t77d9d91bj93b58334d7d0af1f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Jan 7, 2008 4:27 PM, Richard Broersma Jr <rabroersma(at)yahoo(dot)com> wrote:
> --- On Mon, 1/7/08, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com> wrote:
>
> > select max(col1) from table
> > union all
> > select max(col2) from table
> > union all
> > select max(col3) from table
>
> Would the following work also?
>
> SELECT MAX( GREATEST( col1, col2, col3 ) )
> FROM TABLE;

Not given his example output. Given that output, he wants the max of
each column, and your example would only return a single value.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Emi Lu 2008-01-07 22:37:56 Re: Get the max(value1, value2, value3) from a table
Previous Message Richard Broersma Jr 2008-01-07 22:27:40 Re: Get the max(value1, value2, value3) from a table