SELECT
*
FROM
(
SELECT
ROWNUM NUM,TEMP1.*
FROM
(
SELECT
DISTINCT
C1.*,
C2.*,
C4.*,
C5.*,
C6.*,
C7.*
FROM
CUSTOMER C1
LEFT JOIN B ON C1.ID = B.ID
LEFT JOIN C2 ON C1.ID = C2.ID
LEFT JOIN C3 ON C1.ID = C3.ID
LEFT JOIN C4 ON C1.ID = C4.ID
LEFT JOIN C5 ON C1.ID = C5.ID
LEFT JOIN C6 ON C1.ID = C6.ID
LEFT JOIN C7 ON C6.ID = C7.ID
LEFT JOIN C8 ON C1.ID = C8.ID
LEFT JOIN C9 ON C1.ID = C9.ID
LEFT JOIN C10 ON C1.ID = C10.ID
LEFT JOIN C11 ON C10.ID = C11.ID
WHERE
B.CODE IN('1','2','3','4')
AND
(
C1.NAME LIKE '%张%'
OR C9.NAME LIKE '%张%'
)
AND
(
C3.CONTACT = '13112345678'
OR C8.CONTACT = '13112345678'
OR C9.MOBILE = '13112345678'
OR C11.PHONE = '13112345678'
)
ORDER BY C1.CUSTOMER_ID DESC
)TEMP1
WHERE
ROWNUM <=10
) TEMP2
WHERE
TEMP2.NUM >=1
备注:
主表、关联表数据太多,一查询就块卡死,不能用Inner join 有的关联表没数据,主要是查询条件要管理几张表,不能去掉
------解决思路----------------------
给出执行计划