Fatal error: Uncaught exception 'Exception' with message 'Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GROUP BY r.retailer_id' at line 40<br />Error No: 1064<br />SELECT SQL_CALC_FOUND_ROWS p.product_id as recordId, 'product' as recordType, pd.name AS name, pd.description as description, p.image, p.tax_class_id, p.model, p.price, (SELECT ps2.price FROM product_special ps2 WHERE p.product_id = ps2.product_id AND ps2.customer_group_id = '8' AND ((ps2.date_start = '0000-00-00' OR ps2.date_start < NOW()) AND (ps2.date_end = '0000-00-00' OR ps2.date_end > NOW())) ORDER BY ps2.priority ASC, ps2.price ASC LIMIT 1) AS special, 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 LEFT JOIN product_description pd ON (p.product_id = pd.product_id) LEFT JOIN product_to_store p2s ON (p.p in /home/blue7785/public_html/system/database/mysql.php on line 49