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

Trasposizione di riga di colonna in 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));