2
我有几个列并且进行了调整。我想有多个非透视列,并使用最后一个透视。在原始规范here中显示您只能有一个非枢轴列。带有多个非支点列的T-SQL支点
SELECT <non-pivoted column>,
[first pivoted column] AS <column name>,
[second pivoted column] AS <column name>,
...
[last pivoted column] AS <column name>
FROM
(<SELECT query that produces the data>)
AS <alias for the source query>
PIVOT
(
<aggregation function>(<column being aggregated>)
FOR
[<column that contains the values that will become column headers>]
IN ([first pivoted column], [second pivoted column],
... [last pivoted column])
) AS <alias for the pivot table>
<optional ORDER BY clause>;
有没有一种方法能有更多的非关键列,因为它使用的是第一个之后的所有列摆动我的数据。