I have two tables:
TABLE 1 ID VALUE 1 ABC 2 DEF 3 GHI 4 JKL 5 XYZ TABLE 2 ID T1_ID VALUE 1 1 A 2 1 B 3 2 A 4 3
Tadaaah! Without a subquery.
select distinct t1.* from Table1 t1 inner join Table2 t2a on t2a.t1_ID = t1.ID and t2a.VALUE = 'A' inner join Table2 t2b on t2b.t1_ID = t1.ID and t2b.VALUE = 'B'