我需要将查询结果与表进行比较。我有以下查询:
select
i.person_id,
a.APPELLANT_FIRST_NAME,
a.APPELLANT_MIDDLE_NAME,
a.APPELLANT_LAST_NAME,
a.databaseidnumber,
a.CTAPPEALSNUMBER,
a.NOTICEOFAPPEALFILEDDATE,
a.RECORDDUEDATE,
a.PETITIONONAPPEALDUEDATE,
a.PETITIONONAPPEALFILEDDATE,
a.RESPONSETOPETITIONDUEDATE,
a.RESPONSETOPETITIONFILEDDATE,
a.CERTFILEDDATE,
a.MANDATEISSUEDDATE
from CWLEGAL.individuals i inner join CWLEGAL.tblappealsdatarevisionone a
on a.d_n_number1 = i.casenm and a.appellant_first_name = i.first_name and a.appellant_last_name = i.last_name
order by databaseidnumber;
现在,我需要查看表A中的数据库id编号没有出现在上述查询的结果中。
答案 0 :(得分:0)
您可以使用left join
并检查null
:
select a.*
from CWLEGAL.tblappealsdatarevisionone a left join
CWLEGAL.individuals i
on a.d_n_number1 = i.casenm and
a.appellant_first_name = i.first_name and
a.appellant_last_name = i.last_name
where i.casenm is null