Invalid use of group function - HELP
I am, currently switching my website from an access DB to mySQL. I am getting an error "Invalid use of group function" when trying to execute the code below:
SELECT Max(Orders.date) AS MaxOfdate, Count(Orders.ProductsID) AS CountOfProductsID,
Year(date) AS myyear, Month(date) AS mymonth, Dayofmonth(date) AS myday
FROM Orders GROUP BY Year(date), Month(date), Dayofmonth(date), Orders.ProductsID
HAVING (((Orders.ProductsID)=1)) ORDER BY Max(Orders.date)
Can someone help please.
RE: invalid grouop function
thanks for your reply. However I am using mySQL and as far as I know (i am not an expert so i may be wrong) dayofmonth is a valid function. I will try to enclose date in  as [date].
I am doing the query this way because i need to get a broken down list of sales on a daily basis. If you can think of a better way to do it please do not hesitate. As I said I am not an expert but I am very keen in learning.
Again thanks for your help