存在t1 不存在t2的数据: select * from table1 t1 where not exists (select 1 from table2 t2 where t1.id = t2.id ) 存在t2 不存在t1的数据: select * from table2 t2 where not exists (select 1 from table1 t1 where t1.id = t2.id )