后不匹配的行我不知道如何正确地问这个,但在这里它是:回流连接两个表
表1
id | email
---------------------------
1 [email protected]
---------------------------
2 [email protected]
---------------------------
3 [email protected]
---------------------------
4 [email protected]
---------------------------
5 [email protected]
---------------------------
6 [email protected]
---------------------------
7 [email protected]
表2
id | email_two
---------------------------
7 [email protected]
---------------------------
10 [email protected]
---------------------------
33 [email protected]
---------------------------
99 [email protected]
---------------------------
109 [email protected]
---------------------------
299 [email protected]
问题:
如何正确连接两个表,并通过电子邮件获得不匹配的结果?例如,我需要从两个表中获得的是:
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
因为其他电子邮件相互匹配。
代码
SELECT email_two FROM table2 b WHERE NOT EXISTS (SELECT * FROM table1 a WHERE a.email = b.email_two
此代码只返回从表2失踪的人,但我不能找到一个正确的方法,从两个表在一个查询返回结果失踪。
感谢您的任何答案。
谢谢。这是工作。 – Tauras