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

Converti righe in colonne Oracle SQL

Puoi enumerare le righe con row_number() e fai pivot :

select * 
  from (
    select d.*, row_number() over(partition by type order by id) rn from data d)
  pivot (max(type) type, max(id) id for type in ('test1' t1, 'test2' t2))