Hi, I have several procedures that I have taken from an old Microsoft database, and I have tired to use them in a MySQL 5.1.32 database, but I am getting errors when trying to input them. There are three in total that I am struggling with and would appreciate some guidance...

This is a cross selling query:

CREATE PROCEDURE 'xxxxx'.'CrossSelling' ()
BEGIN
SELECT TOP 5 OrderDetails.ProductID, OrderDetails.ProductName, Count(OrderDetails.ProductID) AS CountOfProductID
FROM OrderDetails
WHERE (((OrderDetails.OrderID) In (select OrderID from OrderDetails where ProductID=[pid])))
GROUP BY OrderDetails.ProductID, OrderDetails.ProductName
HAVING (((OrderDetails.ProductID)<>[pid]))
ORDER BY Count(OrderDetails.ProductID) DESC;
END

Error is: 1064

'5 OrderDetails.ProductID, OrderDetails.ProductName, Count(OrderDetails.ProductID' at line 3



If somebody could give me an idea of what is wrong here with regards to it working with MySQL, I might be able to make the other two problem functions work with out too many tears.

Thanks.

Mat

Reply via email to