0
我有以下查詢:Oracle查詢,檢查不存在於其他表
select vw.CONFERENCEID, alert.ALERTID, del.CHANNELID, del.DOCUMENTTEMPLATEID,
vw.starttime, vw.CONFERENCEID, alert.ALERTATTRIBUTEID,
alert.ALERTCATEGORYID, alert.ATTACHMENT, alert.ATTACHMENTLOCATION,
alert.ATTACHMENTNAME
from TBLMCONFERENCE vw,
TBLMSYSTEMALERTS alert,
TBLMALERTDELIVERYREL del,
tblmstandardmaster sm
WHERE alert.Alertid = del.alertid
and sm.masterid = del.CHANNELID
and alert.SYSTEMGENERATED = 'N'
and alert.alertid not in (
select sent.ALERTID
from TBLMSENTALERTHISTORY sent
where sent.REFACCOUNTID = vw.conferenceid
and sent.ALERTID = alert.ALERTID
and sent.CHANNELID = del.CHANNELID
and sent.RESETFLAG = 'N')
我得到記錄,即使在TBLMSENTALERTHISTORY
表中存在匹配的記錄。
這個查詢有什麼問題嗎?
您是否嘗試過觸發內部查詢並檢查alertid是否存在於結果中? –