ブラケットか何かが足りないのかもしれませんが、参加したままのテーブル変数から行を削除して、参加しているキーを探すのに苦労しています。値がある場合は、それを取り除きます。問題は、クエリを解析できないことです。何か案は?
declare @MrTemp
(
key1 int
,key2 int
)
insert into @MrTemp
select key1, key2 from ASourceTable
delete
from @MrTemp mt
left join ARealTable art on mt.key1 = art.key1 and mt.key2 = art.key2
where art.key1 is not null and art.key2 is not null