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 '((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '000' at line 9
Error No: 1064
SELECT COUNT(DISTINCT p.product_id) AS total FROM product p LEFT JOIN product_description pd ON (p.product_id = pd.product_id) LEFT 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 weight_class_description wcd ON (p.weight_class_id = wcd.weight_class_id) LEFT JOIN product_special ps ON (p.product_id = ps.product_id) WHERE pd.language_id = '1' AND p2s.store_id = '0' AND wcd.language_id = '1' AND p.date_available <= NOW() AND p.status = '1' ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) AND ps.product_id NOT IN (SELECT pd2.product_id FROM product_discount pd2 WHERE p.product_id = pd2.product_id AND pd2.customer_group_id = '8' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())))