sql2008以上行转列的方法

时间:2024-01-20 12:00:33

SELECT [column1],[column2],[column3],[column4],[column5]
FROM (select name,id from [tableName] where id>100) as b
PIVOT
(
max(id)
for [name] in([column1],[column2],[column3],[column4],[column5])
) tb