sql >> Base de Datos >  >> RDS >> Oracle

Convertir filas a columnas Oracle SQL

Podría enumerar filas con row_number() y hacer 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))