0

我有下面的查询来使用 PIVOT 按月获取员工工资,但它会抛出一个未正确结束的 SQL 命令。请验证并修复它

SELECT *
FROM (
    SELECT EMPID, MONTH, SALARY
    FROM SALARY
) PIVOT(SALARY AS SALARY FOR (MONTH) IN ('Jan','Feb','Mar'))
ORDER BY EMPID;
4

1 回答 1

0

尝试

SELECT EMPID, MONTH, SALARY
   FROM SALARY
   PIVOT(SALARY AS SALARY FOR MONTH IN ('Jan','Feb','Mar'))
   ORDER BY EMPID;

参考

于 2013-09-05T11:20:58.827 回答