所以在TSQL中,我可以做类似
的事情select * from tbl1 a
where a.key1 = (select b.key1 from tbl2 b where a.key1 = b.key1 and a.key2 = b.key2)
我试图在teradata中实现相同的概念,但没有运气。我怎样才能在teradata中做到这一点?
答案 0 :(得分:1)
尝试使用WHERE EXISTS
:
SELECT *
FROM tbl1 a
WHERE EXISTS (SELECT b.key1 FROM tbl2b WHERE a.key1 = b.key1 AND a.key2 = b.key2)
您也可以使用联接获得所需的结果:
SELECT a.*
FROM tbl1 a
INNER JOIN tbl2 b
ON a.key1 = b.key1
WHERE a.key2 = b.key2