0
这里在枢查询我不想显示MAX(量)我想只显示金额所以,当我写了金额只有这显示了一个错误“的”关键字枢轴查询MS SQL
附近有语法错误。
select employeeid,[56],[8]
from
(select fs.employeeid,
fd.Code,
fd.Amount from fs_table1 fs
inner join fs_table2 fd on fs.sIndex=fd.sIndex
where fs.comid in (813,814)
and fd.Code in (56,8)
) p
pivot
(max(Amount) for code in ([56],[8])) as pb
order by employeeid
任何解决方案
的'PIVOT'需要的聚集体上枢转。所以当你删除'MAX(Amount)'并且只有'Amount'时,就会导致语法错误。请参阅链接... https://technet.microsoft.com/en-us/library/ms177410(v = sql.105).aspx –