--1
select * from table1 a where not exists(select 1 from table2 b where b.小区名称=a.小区名称 and b.楼号=a.楼号 and b.房号=a.房号);
--2
select distinct 小区名称,楼号,房号 from table2 a where not exists(select 1 from table1 b where b.小区名称=a.小区名称 and b.楼号=a.楼号 and b.房号=a.房号);

解决方案 »

  1.   

    --上面使用exists,也可以使用in
    --1
    SELECT *
      FROM table1 a
     WHERE (a.小区名称, a.楼号, a.房号) NOT IN (SELECT b.小区名称, b.楼号, b.房号 FROM table2 b);
    --2
    SELECT DISTINCT 小区名称, 楼号, 房号
      FROM table2 a
     WHERE (a.小区名称, a.楼号, a.房号) NOT IN (SELECT b.小区名称, b.楼号, b.房号 FROM table1 b);