SELECT DISTINCT listings.*,, listings_premium.pic_1, listings_premium.pic_2 FROM listings LEFT JOIN listings_subcats ON listings.b_id = listings_subcats.b_id LEFT JOIN listings_premium ON listings_premium.b_id = listings.b_id LEFT JOIN listings_add_slocs ON listings_add_slocs.b_id = listings.b_id WHERE listings_subcats.subcat_id = AND listings.state = "NT" AND = 'yes' AND listings.priority=2 ORDER BY listings.priority DESC, CASE WHEN date_start='0000-00-00' THEN '9999-99-99' ELSE date_start END asc PlatinumBlock 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 'AND listings.state = "NT" AND = 'yes' AND listings.priority=2 O' at line 1