Re: Get the max(value1, value2, value3) from a table - Mailing list pgsql-sql

From Scott Marlowe
Subject Re: Get the max(value1, value2, value3) from a table
Date
Msg-id dcc563d10801071437t77d9d91bj93b58334d7d0af1f@mail.gmail.com
Whole thread Raw
In response to Re: Get the max(value1, value2, value3) from a table  (Richard Broersma Jr <rabroersma@yahoo.com>)
List pgsql-sql
On Jan 7, 2008 4:27 PM, Richard Broersma Jr <rabroersma@yahoo.com> wrote:
> --- On Mon, 1/7/08, Scott Marlowe <scott.marlowe@gmail.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.


pgsql-sql by date:

Previous
From: Richard Broersma Jr
Date:
Subject: Re: Get the max(value1, value2, value3) from a table
Next
From: Emi Lu
Date:
Subject: Re: Get the max(value1, value2, value3) from a table