已解决 SELECT count(c1.customer_id) FROM CRM_CUSTOMER C1 where exists( select 1 from CRM_BRAND B where C1.BRAND_ID = B.BRAND_ID and B.BRAND_CODE IN(1,2,3,4) )and (exists( select 1 from CRM_CUSTOMER_ADDRESS C2 where C1.CUSTOMER_ID = C2.CUSTOMER_ID and c2.mobile = '13112345678' )or exists( select 1 from CC_CASE_ITEM C3,CC_CASE c4 where C1.CUSTOMER_ID = C4.CUSTOMER_ID and C4.CASEID = C3.CASEID and C3.Phone = '13112345678' )or exists( select 1 from CRM_CUSTOMER_CONTACT C5 where C1.CUSTOMER_ID = C5.CUSTOMER_ID AND C5.CONTACT_TYPE_ID = 2131 and c5.customer_contact = '13112345678' )or exists( select 1 from CRM_CUSTOMER_CONTACT C6 where C1.CUSTOMER_ID = C6.CUSTOMER_ID AND C6.CONTACT_TYPE_ID = 2132 and c6.customer_contact = '13112345678' ))and (exists( select 1 from CRM_CUSTOMER c7 where C7.CUSTOMER_NAME LIKE '%%' )or exists( select 1 from CRM_CUSTOMER_ADDRESS C8 where C1.CUSTOMER_ID = C8.CUSTOMER_ID and C8.CONSIGNEE LIKE '%%' ))
其他表上创建ID字段的索引
然后语句上加个/*+ first_rows(10)*/ 提示
已解决 SELECT
count(c1.customer_id)
FROM CRM_CUSTOMER C1
where
exists(
select 1 from CRM_BRAND B where C1.BRAND_ID = B.BRAND_ID and B.BRAND_CODE IN(1,2,3,4)
)and (exists(
select 1 from CRM_CUSTOMER_ADDRESS C2
where C1.CUSTOMER_ID = C2.CUSTOMER_ID
and c2.mobile = '13112345678'
)or exists(
select 1 from CC_CASE_ITEM C3,CC_CASE c4
where C1.CUSTOMER_ID = C4.CUSTOMER_ID and C4.CASEID = C3.CASEID
and C3.Phone = '13112345678'
)or exists(
select 1 from CRM_CUSTOMER_CONTACT C5
where C1.CUSTOMER_ID = C5.CUSTOMER_ID AND C5.CONTACT_TYPE_ID = 2131
and c5.customer_contact = '13112345678'
)or exists(
select 1 from CRM_CUSTOMER_CONTACT C6
where C1.CUSTOMER_ID = C6.CUSTOMER_ID AND C6.CONTACT_TYPE_ID = 2132
and c6.customer_contact = '13112345678'
))and (exists(
select 1 from CRM_CUSTOMER c7
where C7.CUSTOMER_NAME LIKE '%%'
)or exists(
select 1 from CRM_CUSTOMER_ADDRESS C8
where C1.CUSTOMER_ID = C8.CUSTOMER_ID
and C8.CONSIGNEE LIKE '%%'
))
<div class="tab_menu">
<div class="tab_page">
<li class="selected">操作结果</li>
</div>
</div>