如果我需要TAB3
在输出中列出列。我该怎么做
select *
from tab2 T2 right join
tab1 T1
on T1.MemNo = T2.MemId
where exists (SELECT 1
FROM TAB3 x
WHERE x.Col1 = T1.SID AND x.Col2 = T2.SVID ) and
T2.MemId IS NULL
样本数据
Tab1
MemNo SID
116537 S110
116537 D011
575777 D012
214438 S110
434611 D114
214438 D011
208368 D012
208368 S110
TAB2
MemID SVID
116537 110
116537 11
214438 11
434675 114
214438 110
575788 12
208368 12
208368 110
TAB3
Col1 Col2
D011 11
S110 110
D114 114
D012 12
预期成绩
MemNo Col2
575777 12
434611 114
萨克斯