用exists,exists是基本语句:select * from table1 a
where exists (select 1 from table2 where ... and  id1=a. id1 and id2=a.id2)