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 e.category_id IN () GROUP BY e.id ) UNION DISTINCT (SELEC' at line 54SQL: (SELECT e.id AS id, e.office_code, e.code, e.top_id, e.date_pub, UNIX_TIMESTAMP(e.date_pub) AS rss_date, e.category_id, cl.name AS category_name, e.dealtype_id, dl.name AS dealtype_name, e.location_id AS location_id, l.parent_id AS location_parent_id, l.coordinates AS location_coord, e.status_id AS status_id, sl.name AS status_name, e.stage_id AS stage_id, st.name AS stage_name, e.price AS price, e.price_old AS price_old, e.area, e.agent_id AS agent_id, el.title AS e_title, el.description AS e_description FROM em_estates AS e LEFT JOIN em_estates_description AS el ON ( el.estate_id = e.id ) LEFT JOIN em_category_lang AS cl ON ( cl.category_id = e.category_id ) LEFT JOIN em_dealtype_lang AS dl ON ( dl.dealtype_id = e.dealtype_id ) LEFT JOIN em_locations AS l ON ( l.id = e.location_id ) LEFT JOIN em_status AS s ON ( s.id = e.status_id ) LEFT JOIN em_status_lang AS sl ON ( sl.status_id = s.id ) LEFT JOIN em_stage_lang AS st ON ( st.stage_id = e.stage_id ) WHERE sl.lang_id = '1' AND st.lang_id = '1' AND cl.lang_id = '1' AND s.visible = 1 AND dl.lang_id = '1' AND el.lang_id = '1' AND e.dealtype_id IN () AND e.category_id IN () GROUP BY e.id ) UNION DISTINCT (SELECT e.id AS id, e.office_code, e.code, e.top_id, e.date_pub, UNIX_TIMESTAMP(e.date_pub) AS rss_date, e.category_id, cl.name AS category_name, e.dealtype_id, dl.name AS dealtype_name, e.location_id AS location_id, l.parent_id AS location_parent_id, l.coordinates AS location_coord, e.status_id AS statis_id, sl.name AS status_name, e.stage_id AS stage_id, st.name AS stage_name, e.price AS price, e.price_old AS price_old, e.area, e.agent_id AS agent_id, el.title AS e_title, el.description AS e_description FROM em_estates AS e LEFT JOIN em_estates_description AS el ON ( el.estate_id = e.id ) LEFT JOIN em_category_lang AS cl ON ( cl.category_id = e.category_id ) LEFT JOIN em_dealtype_lang AS dl ON ( dl.dealtype_id = e.dealtype_id ) LEFT JOIN em_locations AS l ON ( l.id = e.location_id ) LEFT JOIN em_status AS s ON ( s.id = e.status_id ) LEFT JOIN em_status_lang AS sl ON ( sl.status_id = s.id ) LEFT JOIN em_stage_lang AS st ON ( st.stage_id = e.stage_id ) LEFT JOIN em_add_category AS ac ON ( ac.estate_id = e.id ) WHERE sl.lang_id = '1' AND st.lang_id = '1' AND cl.lang_id = '1' AND s.visible = 1 AND dl.lang_id = '1' AND el.lang_id = '1' AND e.dealtype_id IN () AND ac.category_id IN () GROUP BY e.id ) ORDER BY id DESC LIMIT 0,10