Answers for "sql convert row into column"

SQL
0

convert rows to columns in sql server

-- convert rows to columns in sql server (PIVOT)
SELECT Firstname, Amount, PostalCode
FROM (
         SELECT value, columnname
         FROM yourtable
     ) d
PIVOT (
    max(value)
    FOR columnname IN (Firstname, Amount, PostalCode)
) piv;
Posted by: Guest on April-13-2021

Code answers related to "sql convert row into column"

Code answers related to "SQL"

Browse Popular Code Answers by Language