0
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;

I am receiving this error

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[250] AS Emp1,[251] AS Emp2, [252] AS Emp3, [253] AS Emp4, [254] AS Emp5FR' at line 3

  • What is the error you are getting? – Josh Adams Aug 29 '17 at 16:08
  • Please post the error you're receiving, and also your schema. It may be worth putting together an [SQL Fiddle](http://sqlfiddle.com/) to demonstrate the problem. – BenM Aug 29 '17 at 16:12
  • 1
    `PIVOT` in MySQL? That's not part of MySQL's feature set. You can hack it if you must. https://stackoverflow.com/questions/7674786/mysql-pivot-table – O. Jones Aug 29 '17 at 16:23

0 Answers0