Answers for "convert column to rows in sql"

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 "convert column to rows in sql"

Code answers related to "SQL"

Browse Popular Code Answers by Language