Oracle
 sql >> Database >  >> RDS >> Oracle

Oracle - Trasponi le righe in colonne

Potresti farlo con un GROUP BY:

select CLUSTER_K,
  max(case when PROCESS_PHASE=1 then SEM_AGG else null end) SEM_AGG_1,
  max(case when PROCESS_PHASE=2 then SEM_AGG else null end) SEM_AGG_2,
  max(case when PROCESS_PHASE=3 then SEM_AGG else null end) SEM_AGG_3
from test_mc
group by CLUSTER_K