select /*+ use_nl(T@SEL$2,T@SEL$1) leading(T@SEL$2) */ code,name,idcode,address,room,indate
from scotte.T_S_ROOM t
where code in (select code from scotte.T_S_ROOM t where name='张三' and indate ='19941109') ;
hint 首先让其走nl,T@SEL$2,T@SEL$1 分别为主表和in里的表 具体区分可在执行计划里看见,这里要注意表别名的写法
然后用leading,这个hint 指向in的表
注意此种情况:适用于in 里返回数据少的小表做驱动表的情况