📅  最后修改于: 2022-03-11 15:05:25.155000             🧑  作者: Mango
-- 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;