SELECT CASE WHEN
    (SELECT COUNT(*) FROM `dwd_process_outsource_delivery` WHERE `tenant_id`=1300000000001)=0
AND (SELECT COUNT(*) FROM `dwd_process_outsource_delivery_bak_1_0_351`)>0
THEN 1 ELSE 0 END AS ok;
