我正在使用sql server并希望我的表行作为列,当我使用此查询进行转换时,它会给我错误的关键字
'1'附近的语法不正确。 这是我的查询
select strvalue,1,2
from
(select strvalue,nSectionAttributeId,
(row_number() over (partition by nSectionAttributeId order by nsectionattributeid ) ) as colum
from tblAttributeData
)temp
pivot
(
max(nSectionAttributeId)
for colum in (1,2)
)PIV
答案 0 :(得分:0)
select strvalue,1,2
from
(select strvalue,nSectionAttributeId,
(row_number() over (partition by nSectionAttributeId order by nsectionattributeid ) ) as colum
from tblAttributeData
)temp
pivot
(
max(nSectionAttributeId)
for colum in ([1],[2])
)PIV