Hey SO
PHPmyAdmin keeps rejecting this mySQL im pretty sure its right and don't actually need it to run, its uni work and just have to hand in, it looks right to me.
the actual error I get is
#1064 - 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 'END' at line 23
I have tried playing with adding and removing ; to LIMIT and END nether of which help , were am I being stupid?
CREATE PROCEDURE topFive(
IN PID VARCHAR(6),
IN CID VARCHAR(6)
)
BEGIN
SELECT `OrderItem`.`ProductID` , COUNT(*) AS `Popularity`
FROM `OrderItem`,
(
SELECT `Order`.`OrderID`
FROM `OrderItem`,`Order`
WHERE
(`Order`.`OrderID`=`OrderItem`.`OrderID`)
AND
(`OrderItem`.`ProductID`=PID)
AND
(`Order`.`CustomerID`!=CID)
) AS `ORDER_ID_TABLE`
WHERE (`OrderItem`.`OrderID` = `ORDER_ID_TABLE`.`OrderID`)
GROUP BY `OrderItem`.`ProductID`
ORDER BY `Popularity`
LIMIT 0,5
END
thanks ^_^