MySQL query error: file - , line -

SELECT, a1.categoryID, as r_name2, as r_name3, b.category1ID, b.category2ID, count(*) as num FROM lito_shop_category a1, lito_shop_category a2, lito_shop_category a3, lito_shop_products b, lito_shop_products c WHERE b.category2ID=0 AND a1.categoryID = b.category3ID AND a2.categoryID = b.category1ID AND a3.categoryID = b.category2ID AND b.productID = c.productID GROUP BY c.category3ID ORDER BY a1.categoryID

Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column '' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by