Skip to Main Content

Analytics Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

find MIN, MAX of multiple rows from multiple columns

965732Oct 9 2012 — edited Oct 10 2012
Hello,

I need to figure out how to pull the MIN/MAX of multiple rows from multiple columns into one column. Even if some are NULL/blank.

For Example: (C: Column, R: Row, N - NULL/Blank)

C:____1____2____3____ 4____Max
R:____20___22___13____4____*22*
R:____N____N____32____14___*32*
R:____N____12____N____N____*12*

That is, it always gives a value for MIN/MAX unless there are NO values in all the rows of the columns.

So if there is one value, it will select that for the MIN/MAX, as it's the smallest/biggest since there is nothing to compare it to.

Here is my current code:

CASE WHEN COLUMN 1 < COLUMN 2 THEN COLUMN 2 ELSE COLUMN 1 END
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 7 2012
Added on Oct 9 2012
2 comments
654 views