1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
select *
from TEST;
PK I J
---------- ---------- ----------
1 1 2
1 2 3
1 3 4
2 1 2
select pk,
decode(i, 1, j) i_1,
decode(i, 2, j) i_2,
decode(i, 3, j) i_3
from TEST;
PK I_1 I_2 I_3
---------- ---------- ---------- ----------
1 2
1 3
1 4
2 2
-- oui mais on veut une ligne par clé primaire
select pk,
max(decode(i, 1, j)) i_1,
max(decode(i, 2, j)) i_2,
max(decode(i, 3, j)) i_3
from TEST
group by pk;
PK I_1 I_2 I_3
---------- ---------- ---------- ----------
1 2 3 4
2 2 |
Partager