pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Scott Marlowe <smarlowe@g2switchworks.com>
To: emilu@encs.concordia.ca
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Amos Hayes <ahayes@polkaroo.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: Find min and max values across two columns?
Date: Mon, 15 May 2006 16:50:08 -0500
Message-ID: <1147729808.9755.157.camel@state.g2switchworks.com> (raw)
In-Reply-To: <4468F558.7070407@encs.concordia.ca>
References: <DAD4674C-1896-4F24-B43B-B884491DB931@polkaroo.net>
	<9558.1143234035@sss.pgh.pa.us>
	<4468F558.7070407@encs.concordia.ca>

On Mon, 2006-05-15 at 16:40, Emi Lu wrote:
> Hello,
> 
> I tried "select greatest(max(a), max(b)) from public.test",  but I got 
> the following errors:
> 
> ERROR:  function greatest(integer, integer) does not exist
> HINT:  No function matches the given name and argument types. You may 
> need to add explicit type casts.
> 
> May I know where I can read the docs about greatest & least please.
> 
> I am using  PostgreSQL 8.0.7.

You need to define your problem better.  Assuming these data:

a  b
12 24
24 12
13 18
25 10

which should I get for greatest(max(a), max(b)) should I get?  Do you
just want 25,24???  In that case you don't need greatest.  Do you need
the highest total between the two, or what?



view thread (11+ messages)  latest in thread

Message-ID: <1147729808.9755.157.camel@state.g2switchworks.com>
Permalink:  ../1147729808.9755.157.camel@state.g2switchworks.com/
Also on:    postgresql.org/message-id/1147729808.9755.157.camel@state.g2switchworks.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: smarlowe@g2switchworks.com, emilu@encs.concordia.ca, tgl@sss.pgh.pa.us, ahayes@polkaroo.net
  Subject: Re: Find min and max values across two columns?
  In-Reply-To: <1147729808.9755.157.camel@state.g2switchworks.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