Error: Out of sort memory, consider increasing server sort buffer size
Error No: 1038
SELECT *, p.product_id, p.price AS price, pd.name AS name, p.image, m.name AS manufacturer, ss.name AS stock, (SELECT AVG(r.rating) FROM review r WHERE p.product_id = r.product_id GROUP BY r.product_id) AS rating FROM product p INNER JOIN product_description pd ON (p.product_id = pd.product_id) INNER JOIN product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN stock_status ss ON (p.stock_status_id = ss.stock_status_id) INNER JOIN product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN product_special ps ON (p.product_id = ps.product_id) INNER JOIN category C ON C.category_id = p2c.category_id WHERE p.status = 1 AND CASE WHEN C.is_archive THEN p.quantity = 0 ELSE (p.quantity > 0 OR p.display_when_outofstock = 1) END AND p.date_available <= NOW() AND pd.language_id = 1 AND p2s.store_id = '' AND ss.language_id = 1 AND p2c.category_id =101 ORDER BY p.date_added DESC LIMIT 0,80