Oracle
 sql >> Base de Dados >  >> RDS >> Oracle

Transposição de linha de coluna no Oracle Sql

WITH t AS
     (SELECT 1001 studentid, 'john' NAME FROM dual
     UNION ALL
     SELECT 1002, 'kane' FROM dual
     )
SELECT * FROM (
SELECT studentid, NAME FROM t)
pivot (max(studentid) for name in ('john' John, 'kane' Kane));