select * from 表1 a
where exists(select * from 表2 where a.主键=b.主键)  --根据主键判断是否相同,如果是根据其他字段,对应改为其他字段