SQL> drop table t purge;
Table dropped.
SQL> create table t ( x int, y int, z number );
Table created.
SQL>
SQL>
SQL> insert into t values (1,2,0.852 );
1 row created.
SQL> insert into t values (1,3,0.433 );
1 row created.
SQL> insert into t values (1,4,0.538 );
1 row created.
SQL> insert into t values (2,3,0.991 );
1 row created.
SQL> insert into t values (2,4,0.604 );
1 row created.
SQL> insert into t values (3,4,0.597 );
1 row created.
SQL>
SQL> select val, min(z)
2 from
3 ( select x val, z from t
4 union all
5 select y, z from t
6 )
7 group by val;
VAL MIN(Z)
---------- ----------
1 .433
2 .604
4 .538
3 .433
4 rows selected.
SQL>
SQL>
or you could use UNPIVOT
SQL> select id, min(z)
2 from t
3 unpivot (id for tag in (x as 'x', y as 'y'))
4 group by id;
ID MIN(Z)
---------- ----------
1 .433
2 .604
4 .538
3 .433
4 rows selected.