I have a problem with my query and mysql throws the following error:
#1055 - Expression #66 of SELECT list is not in GROUP BY clause and contai
Are you trying to do an ORDER BY? The GROUP BY clause attempts to return one row for each distinct value in the column in the GROUP BY clause, unless you add more columns to the clause. The error is being thrown because you have other non-aggregated columns that are not being included in the clause - aggregated columns would be something like MAX(p.products_id) or SUM(p.products_price). In your query, there are multiple rows with the same p.product_price and different s.status values, so the GROUP BY isn't meaningful.
MySQL Group By handling: https://dev.mysql.com/doc/refman/5.7/en/group-by-handling.html Aggregate functions: http://dev.mysql.com/doc/refman/5.7/en/group-by-functions.html