Table 'biznetwork.user_campaign_coupons' doesn't existselect count(*) as count from(Select c.* from users U LEFT JOIN categories_reserved CR on (U.user_id = CR.user_id) LEFT JOIN user_campaign_coupons c on(U.user_id=c.user_id) where CR.category_id = "471" and if(c.expired_status="0",c.expired_on>"2020-09-18 10:22:04",c.expired_on="") and c.coupon_type="smscoupon" Union Select c.* from user_campaign_coupons c where c.biz_cat_name = "pizza" and c.expired_on>"2020-09-18 10:22:04" and c.coupon_type="bizteam" and c.biz_parent_id="0" ) as t LIMIT 1