SELECT deal.*, if(deal.`list_price` % 1 = 0,cast(deal.`list_price` as unsigned),deal.`list_price`) as `list_price`, if(deal.`sales_price` % 1 = 0,cast(deal.`sales_price` as unsigned),deal.`sales_price`) as `sales_price`, store.store_name as store_name, store.image as store_image , store.`store_slug` as store_slug FROM dealninja_deals AS deal LEFT JOIN dealninja_stores AS store on store.store_id = deal.store_id WHERE deal.category_id = 4 AND deal.`subcategory_id` = AND (deal.`start`<='2013-06-19 04:51:36') ORDER BY deal.`status` DESC, deal.`start` DESC
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 (deal.`start`<='2013-06-19 04:51:36') ORDER BY deal.`status` DESC, deal.`st' at line 1 on 1064