Hi Carlos,
How about the following ?
--------------------------------------------
SQL> select * from t;
ID COL1 COL2
---------- ---------- ----------
1 10 20
2 20 30
3 12 23
SQL> select id, max(col) from (
2 select id, col1 as col from t
3 union
4 select id, col2 as col from t
5 )
6 group by id;
ID MAX(COL)
---------- ----------
1 20
2 30
3 23
SQL>
--------------------------------------------
Cheers,
Prat
|