Sqlserver
 sql >> Datenbank >  >> RDS >> Sqlserver

So konvertieren Sie Zeilenwerte in Spalten in SQL Server 2005

SELECT grsid,contactid, [1] rejectcode, [12] rejectcode, [89] rejectcode
FROM **rjct1**
PIVOT (MAX(rejectcode)
    FOR rejectcode IN ([1] , [12], [89])
) AS pvt