select * from A where cc in (select cc from B) select * from A where exists(select cc from B where cc=A.cc)