A Database Error Occurred

Error Number: 1064

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 ') AND (of.offer_end_date > '2024-03-29' || of.offer_end_date = '0000-00' at line 16

SELECT count(DISTINCT(of.offer_id)) as nr, offer_type as type, me.*, max(if(of.offer_rate_type='value',of.offer_currency,0)) as money, max(if(of.offer_rate_type='value',of.offer_rate_value,0)) as max_rate_money, max(if(of.offer_rate_type='percent',of.offer_rate_value,0)) as max_rate_percent, GROUP_CONCAT(DISTINCT offer_type SEPARATOR ',') as types FROM merchants as me JOIN offers as of ON me.merchant_id = of.merchant_id AND of.status = '1' JOIN offers_categories as cat ON of.offer_id = cat.offer_id JOIN categories as cats ON cat.category_id = cats.category_id WHERE me.status='1' AND me.merchant_id IN () AND (of.offer_end_date > '2024-03-29' || of.offer_end_date = '0000-00-00 00:00:00') GROUP BY me.merchant_id

Filename: /var/www/1_original/controllers/promotions.php

Line Number: 158