在我的Pivot MYSQL代码上获取语法错误这是我的代码

时间:2017-08-29 16:07:28

标签: mysql

SELECT VendorID,[250] AS "Emp1",[251] AS "Emp2",[252] AS "Emp3",[253] AS "Emp4",[254] AS "Emp5"
FROM (SELECT
    PurchaseOrderID
   ,EmployeeID
   ,VendorID
  FROM Purchasing.PurchaseOrderHeader) p

PIVOT
(
  COUNT(PurchaseOrderID) FOR EmployeeID IN ([250], [251], [252], [253], [254])
) AS t
ORDER BY t.VendorID;

我收到此错误

错误1064(42000):您的SQL语法有错误;检查与您的MySQL服务器版本相对应的手册,以便使用正确的语法,以便在[...] [Emp],[251] AS Emp2,[252] AS Emp3,[253] AS Emp4,[254] AS Emp5FR& #39;在第3行

0 个答案:

没有答案