select T2.C
from T2
where Exists(select *
from T1,T3
where T1.B=T2.B and T2.C=T3.C and D='value');
你想输出C的话,主查询里from T2或T3都可以。
select t1.A,t.B,t.C
from t1,(select T2.B,T3.C from t2 join t3 on t2.C=t3.C) t
where t1.B=t.B;
Semi-join 限制
不过并不是所有子查询都是半联接,必须满足以下条件: