मुझे यहां क्रॉस अप्लाई का उपयोग करने में कोई लाभ नहीं दिख रहा है। यहाँ एक सरल उपाय है जो काम करता है:
declare @t table(recordid int)
declare @tableone table(recordid int)
declare @tabletwo table(recordid int)
declare @tablethree table(recordid int)
insert @t values(101),(102),(103),(104),(105),(106)
insert @tableone values(101),(102),(103),(104)
insert @tablethree values(101),(102)
delete t
from @t t
where not exists (select 1 from @tableone where t.recordid = recordid)
and exists (select 1 from @tableone)
or not exists (select 1 from @tabletwo where t.recordid = recordid)
and exists (select 1 from @tabletwo)
or not exists (select 1 from @tablethree where t.recordid = recordid)
and exists (select 1 from @tablethree)
परिणाम:
recordid
101
102