Select *from t1left join T2 on T2.sysno =t1. Asysnoleft join T3 on T3.sysno =t2. Asysnoleft join T4 on T4.sysno =t3. Asysnoleft join T5 on T5.sysno =t4. Asysnoleft join T6 on T6.sysno =t5. Asysnoleft join T7 on T7.sysno =t6. Asysnowhere t1.name like '%aaa% '
In the absence of any indexes, fuzzy queries, such SQL performance is the worst, such SQL for the Federated query SQL
Select *from t1left join ( Select * from T2 left joins T3 on T3.sysno =t2. Asysno left joins T4 on T4.sysno =t3. Asysno) Vw_detail on vw_detail. Sysno =t1. Asysnoleft Join ( Select * from T5 left joins T6 on T6.sysno =t5. Asysno left joins T7 on T7.sysno =t6. Asysno) vw_mm on vw_mm.sysno = t1. Ssysnowhere charindex (' AAA ', t1.name) >0
The SQL uses Left-join to classify a class of data, remove the like query, minimize the use of functions in the where, and then index the foreign keys of each table; this kind of SQL query is called Federated categorical query SQL. Generally query after this rule query should be very fast
The above SQL is for reference only
SQL statement and performance combined query and federated classification query