📜  sql server 将行转为列 - SQL 代码示例

📅  最后修改于: 2022-03-11 15:04:54.610000             🧑  作者: Mango

代码示例1
select Firstname, Amount, PostalCode, LastName, AccountNumber
from
(
  select value, columnname
  from yourtable
) d
pivot
(
  max(value)
  for columnname in (Firstname, Amount, PostalCode, LastName, AccountNumber)
) piv;