MySQL query error: file - , line -

SELECT, a1.categoryID, as r_name2, as r_name3, b.category1ID, b.category2ID, count(*) as num FROM sewc_shop_category a1, sewc_shop_category a2, sewc_shop_category a3, sewc_shop_products b, sewc_shop_products c WHERE b.category2ID=2 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