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

Oracle SQL para converter linhas relacionadas em uma única linha


use PIVOT
SELECT * FROM
(SELECT "RollNo", "Name", 
"Subject", "score" FROM Table1)  T
PIVOT
( max("score") for "Subject" in
   ('English' as English_score,
    'French'  as French_score,
    'Germany' as Germany_score,
    'Spanish' as Spanishh_score
    )
)