1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
SQL> with matable as (
2 select 'AA' col1,'BB' col2,'CC' col3 from dual union all
3 select 'AA','DD','EE' from dual union all
4 select 'AA','FF','GG' from dual union all
5 select 'BB','HH','II' from dual union all
6 select 'BB','JJ','KK' from dual union all
7 select 'CC','LL','MM' from dual)
8 select col1,
9 max(col2) keep (dense_rank first order by col2,col3) col2,
10 max(col3) keep (dense_rank first order by col2,col3) col3
11 from matable
12 group by col1;
CO CO CO
-- -- --
AA BB CC
BB HH II
CC LL MM |
Partager