查询在A表有记录数据,B表没有记录数据的SQL

select a.site_planning_id,a.station_type_key from pl_cover_point a where a.station_type_key='440000104001' and a.station_level_key='440000917001' 
and a.site_planning_id not in (select b.site_planning_id from pl_macro_station b)

-- 宏站细化缺少 23147 条

select a.site_planning_id,a.station_type_key from pl_cover_point a where a.station_type_key='440000104002' and a.station_level_key='440000917001' 
and a.site_planning_id not in (select b.site_planning_id from pl_micro_station b)

-- 微小站细化缺少 8838 条

select a.site_planning_id,a.station_type_key from pl_cover_point a where a.station_type_key='440000104003' and a.station_level_key='440000917001' 
and a.site_planning_id not in (select b.site_planning_id from pl_indoor b)

-- 室分站细化缺少 17485 条

select a.site_planning_id,a.station_type_key from pl_cover_point a where a.station_level_key='440000917002' 
and a.site_planning_id not in (select b.site_planning_id from pl_cell b)

-- 小区站细化缺少 0 条
原文地址:https://www.cnblogs.com/chuyuan/p/13957518.html