Answers for "convert columns to row 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 columns to row in sql"

Code answers related to "SQL"

Browse Popular Code Answers by Language