使用PHP和MySQL连接多个表时无法获得价值

I have an issue in my SQL query. I need to fetch value from DB by joining multiple tables but I could not get the data for some condition. I am explaining my query below.

    SELECT  b.member_id as b_member_id,b.rest_name,b.city,b.proviance,b.postal,
                b.address,b.country,b.person,b.mobile,b.url,b.status,b.premium,b.image,
                b.business_phone_no,b.email,b.multiple_image,b.latitude,b.longitude,
                b.quadrant,d.member_id as d_member_id,d.day_id,d.cat_id,d.subcat_id,
                d.comment,d.city,d.special_images,c.cat_id,c.special,sub.subcat_id,sub.subcat_name,
                sub.status,sl.day_id,sl.member_id,sl.date_from,sl.date_to 

    FROM db_restaurant_basic as b 
    LEFT JOIN db_restaurant_detail as d ON b.member_id=d.member_id 
    LEFT JOIN db_category as c ON d.cat_id=c.cat_id 
    LEFT JOIN db_subcategory as sub ON d.subcat_id=sub.subcat_id 
    LEFT JOIN db_special_images as sl ON d.day_id=sl.day_id 
    WHERE b.city='2' 
    AND d.day_id='1' 
    AND c.special='1' 
    AND sl.date_from <='2016-10-31' 
    AND sl.date_to >= '2016-10-31' 
    AND b.status=1 
    AND sub.status=1 
    AND sl.date_from !='' 
    AND sl.date_to !='' 
    UNION ALL 
    SELECT      b.member_id,b.rest_name,b.city,b.proviance,b.postal,b.address,
                b.country,b.person,b.mobile,b.url,b.status,b.premium,b.image,
                b.business_phone_no,b.email,b.multiple_image,b.latitude,b.longitude,
                b.quadrant,d.member_id,d.day_id,d.cat_id,d.subcat_id,d.comment,
                d.city,d.special_images,c.cat_id,c.special,sub.subcat_id,sub.subcat_name,
                sub.status,sl.day_id,sl.member_id,sl.date_from,sl.date_to 
    FROM db_restaurant_basic as b 
    LEFT JOIN db_restaurant_detail as d ON b.member_id=d.member_id 
    LEFT JOIN db_category as c ON d.cat_id=c.cat_id 
    LEFT JOIN db_subcategory as sub ON d.subcat_id=sub.subcat_id 
    LEFT JOIN db_special_images as sl ON d.day_id=sl.day_id 
    WHERE b.city='2' 
    AND d.day_id='1' 
    AND c.special='1' 
    AND b.status=1 
    AND sub.status=1 
    AND sl.date_from ='' 
    AND sl.date_to ='' 
    ORDER BY b_member_id DESC;

Here i am not getting any value while db_special_images has no entry for this sl.date_from ='' and sl.date_to =''. Here i need the value should come while any one of following condition will match.

Condition

  1. If In db_special_images table (date_from ='' and date_to ='') and (date_from !='' and date_to !='').

  2. If In db_special_images table (date_from ='' and date_to ='').

  3. If In db_special_images table (date_from !='' and date_to !='').

I need if one of any above condition will match the value should come.