SELECT * FROM TAB1 WHERE (ID1,ID2) IS IN (SELECT ID1,ID2 FROM TAB2)
ID1和ID2是TAB1和TAB2的两个主键, 我们可以用单个主键来完成它但是如何处理2个主键
答案 0 :(得分:2)
SELECT *
FROM tab1
WHERE EXISTS
(
SELECT NULL
FROM tab2
WHERE tab2.id1 = tab1.id1
AND tab2.id2 = tab1.id2
)