Oracle : select maximum value from different columns of the same row

Posted by gregseth on Stack Overflow See other posts from Stack Overflow or by gregseth
Published on 2010-05-28T10:06:04Z Indexed on 2010/05/28 12:01 UTC
Read the original article Hit count: 169

Filed under:
|
|
|

The whole question is pretty much in the title. For each row of the table I'd like to select the maximum of a subset of columns.

For example, from this table

name m1 m2 m3 m4
A     1  2  3  4
B     6  3  4  5
C     1  5  2  1

the result would be

name max
A      4
B      6
C      5

The query must be compatible oracle 8i.

Thanks.

© Stack Overflow or respective owner

Related posts about sql

Related posts about Oracle