```sql # ★直播试用 select ei.enterprise_id from enterprise_info ei left join ep_product_chargemode epc on ei.enterprise_id = epc.enterprise_id left join self_service_domain_config ssdc on ssdc.tenant_id = epc.enterprise_id where epc.product_state in (3, 6) and ssdc.product = epc.product_id and ei.source = 'BSS' and ssdc.product not in (0, 1, 2, 3, 8, 9) and ei.enter_province = '安徽' group by ei.enterprise_id; # ★直播商用 select ei.enterprise_id from enterprise_info ei left join ep_product_chargemode epc on ei.enterprise_id = epc.enterprise_id left join self_service_domain_config ssdc on ssdc.tenant_id = epc.enterprise_id where epc.product_state in (4) and ssdc.product = epc.product_id and ei.source = 'BSS' and ssdc.product not in (0, 1, 2, 3, 8, 9) and ei.enter_province = '北京' group by ei.enterprise_id; # ★点播试用 select ei.enterprise_id from enterprise_info ei left join ep_product_chargemode epc on ei.enterprise_id = epc.enterprise_id left join self_service_domain_config ssdc on ssdc.tenant_id = epc.enterprise_id where epc.product_state in (3, 6) and ssdc.product = epc.product_id and ei.source = 'BSS' and ssdc.product in (0, 1, 2, 3, 8, 9) and ei.enter_province = '安徽' group by ei.enterprise_id; # ★点播商用 select ei.enterprise_id from enterprise_info ei left join ep_product_chargemode epc on ei.enterprise_id = epc.enterprise_id left join self_service_domain_config ssdc on ssdc.tenant_id = epc.enterprise_id where epc.product_state in (4) and ssdc.product = epc.product_id and ei.source = 'BSS' and ssdc.product in (0, 1, 2, 3, 8, 9) and ei.enter_province = '北京' group by ei.enterprise_id; # ★点播试用 排除存在商用的企业 SELECT ei.enterprise_id FROM enterprise_info ei LEFT JOIN ep_product_chargemode epc ON ei.enterprise_id = epc.enterprise_id LEFT JOIN self_service_domain_config ssdc ON ssdc.tenant_id = epc.enterprise_id WHERE epc.product_state IN (3, 6) AND ssdc.product = epc.product_id AND ei.source = 'BSS' AND ssdc.product IN (0, 1, 2, 3, 8, 9) AND ei.enter_province = '北京' AND NOT EXISTS ( -- 排除点播商用 SELECT 1 FROM ep_product_chargemode epc_excl LEFT JOIN self_service_domain_config ssdc_excl ON ssdc_excl.tenant_id = epc_excl.enterprise_id WHERE epc_excl.enterprise_id = ei.enterprise_id AND epc_excl.product_state IN (4) AND ssdc_excl.product = epc_excl.product_id AND ssdc_excl.product IN (0, 1, 2, 3, 8, 9)) AND NOT EXISTS ( -- 排除直播商用 SELECT 1 FROM ep_product_chargemode epc_excl LEFT JOIN self_service_domain_config ssdc_excl ON ssdc_excl.tenant_id = epc_excl.enterprise_id WHERE epc_excl.enterprise_id = ei.enterprise_id AND epc_excl.product_state IN (4) AND ssdc_excl.product = epc_excl.product_id AND ssdc_excl.product NOT IN (0, 1, 2, 3, 8, 9)) GROUP BY ei.enterprise_id; # ★直播试用 排除存在商用的企业 SELECT ei.enterprise_id FROM enterprise_info ei LEFT JOIN ep_product_chargemode epc ON ei.enterprise_id = epc.enterprise_id LEFT JOIN self_service_domain_config ssdc ON ssdc.tenant_id = epc.enterprise_id WHERE epc.product_state IN (3, 6) AND ssdc.product = epc.product_id AND ei.source = 'BSS' AND ssdc.product NOT IN (0, 1, 2, 3, 8, 9) AND ei.enter_province = '北京' AND NOT EXISTS ( -- 排除点播商用 SELECT 1 FROM ep_product_chargemode epc_excl LEFT JOIN self_service_domain_config ssdc_excl ON ssdc_excl.tenant_id = epc_excl.enterprise_id WHERE epc_excl.enterprise_id = ei.enterprise_id AND epc_excl.product_state IN (4) AND ssdc_excl.product = epc_excl.product_id AND ssdc_excl.product IN (0, 1, 2, 3, 8, 9)) AND NOT EXISTS ( -- 排除直播商用 SELECT 1 FROM ep_product_chargemode epc_excl LEFT JOIN self_service_domain_config ssdc_excl ON ssdc_excl.tenant_id = epc_excl.enterprise_id WHERE epc_excl.enterprise_id = ei.enterprise_id AND epc_excl.product_state IN (4) AND ssdc_excl.product = epc_excl.product_id AND ssdc_excl.product NOT IN (0, 1, 2, 3, 8, 9)) GROUP BY ei.enterprise_id; ```