【发布时间】:2021-02-08 04:25:58
【问题描述】:
我正在尝试重命名 SQL Server 中的数据透视列,即
for days in ([22], [23], [24], [25], [26], [27], [28]
有没有办法做到这一点?
这是我的查询:
select *
from
(select
day(date) as days,
temp
from
temperature) as t
pivot
(max(temp)
for days in ([22], [23], [24], [25], [26], [27], [28])
) as pivot_table
【问题讨论】:
-
rename pivot columns到底是什么意思?您是指结果中的列吗? -
是的,我想将列从整数 22 重命名为二十二,从 23 重命名为二十三,依此类推。
-
SELECT [22] as [twenty-two], [23] as [twenty-three], . . .
标签: sql sql-server tsql pivot