Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: MIN and MAX function between colums

Re: MIN and MAX function between colums

From: Stephan Born <stephan.born_at_beusen.de>
Date: Mon, 29 Oct 2001 14:57:44 +0100
Message-ID: <3BDD6058.229317C9@beusen.de>


> Min and Max calculated something for one column. Does that also between
> columns like
>
> min(column1, column2) ?

select greatest( col1, col2 ) from tab;

gives for each row the max-value for these 2 columns.

select least( col1, col2 ) from tab;

gives you for each row the min-value for these 2 columns.

You can use more than 2 values in these functions. And you can select the overal min/max-value for the table:

select max( greatest( col1, col2 ) ) from tab; select min( least( col1, col2 ) ) from tab;

Regards, Stephan Received on Mon Oct 29 2001 - 07:57:44 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US