MySQL query error: file - /var/www/sewc/data/www/7dress.ru/inc/spec_blocks/service/shop.php, line - 240

SELECT a1.name, a1.categoryID, a2.name as r_name2, a3.name as r_name3, b.category1ID, b.category2ID, count(*) as num FROM tmc_shop_category a1, tmc_shop_category a2, tmc_shop_category a3, tmc_shop_products b, tmc_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 'myfatin_ru.a1.name' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by