我有几列并制作支点。我想有多个非枢轴列并使用最后一个进行枢轴。在此处的原始规范中,显示您只能拥有一个非枢轴列。
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>;
有没有办法拥有更多的非透视列,因为它使用第一列之后的所有列来旋转我的数据。