pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Scott Marlowe <scott.marlowe@gmail.com>
To: Richard Broersma Jr <rabroersma@yahoo.com>
Cc: emilu@encs.concordia.ca
Cc: pgsql-sql@postgresql.org
Subject: Re: Get the max(value1, value2, value3) from a table
Date: Mon, 7 Jan 2008 16:37:52 -0600
Message-ID: <dcc563d10801071437t77d9d91bj93b58334d7d0af1f@mail.gmail.com> (raw)
In-Reply-To: <239138.99803.qm@web31804.mail.mud.yahoo.com>
References: <dcc563d10801071416y4084231fie0261030ef4e071a@mail.gmail.com>
	<239138.99803.qm@web31804.mail.mud.yahoo.com>

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.



view thread (11+ messages)  latest in thread

Message-ID: <dcc563d10801071437t77d9d91bj93b58334d7d0af1f@mail.gmail.com>
Permalink:  ../dcc563d10801071437t77d9d91bj93b58334d7d0af1f@mail.gmail.com/
Also on:    postgresql.org/message-id/dcc563d10801071437t77d9d91bj93b58334d7d0af1f@mail.gmail.com

 · 

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: scott.marlowe@gmail.com, rabroersma@yahoo.com, emilu@encs.concordia.ca
  Subject: Re: Get the max(value1, value2, value3) from a table
  In-Reply-To: <dcc563d10801071437t77d9d91bj93b58334d7d0af1f@mail.gmail.com>

* 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