select * from `AAAA` where aiui_id in (select caseId from task_case_202203 where taskId = ? and caseTable = ? ) and aiui_id NOT IN (select caseId FROM **case_result_202203** WHERE taskId = ? and tableName = ? ) ORDER BY aiui_id ASC
case_result_202203表的分表规则为根据taskId进行hash_mod
-
当把not in里面的子查询拆出来单独执行(select caseId FROM case_result_202203 WHERE taskId = ? and tableName = ?),这条语句是分表查询的。
-
当全sql整体执行时,进行了跨表查询。