レコード数を比較するクエリ
select *
from
(
select
kyujin_id
,touroku_dt
,haishin_flg
,remind_flg
,mensetsu_kakuyaku_flg
,haishin_su
,oubo_su
from sandbox.scout_flow_1127_haishin_dt
where haishin_shubetsu = 'bb'
and haishin_dt between '2019-11-01' and '2019-11-30'
and oubo_su >= 1
) aaaa
left join
(
select
kyujin_id
,touroku_dt
,haishin_flg
,remind_flg
,mensetsu_kakuyaku_flg
,haishin_su
,oubo_su
from sandbox.scout_flow_1127_haishin_mt
where haishin_shubetsu = 'bb'
and haishin_mt between '2019-11-01' and '2019-11-30'
and oubo_su >= 1
) abc
on
aaaa.kyujin_id = abc.kyujin_id
and aaaa.touroku_dt = abc.touroku_dt
and aaaa.haishin_flg = abc.haishin_flg
and aaaa.remind_flg = abc.remind_flg
and aaaa.mensetsu_kakuyaku_flg = abc.mensetsu_kakuyaku_flg
and aaaa.haishin_su = abc.haishin_su
and aaaa.oubo_su = abc.oubo_su