我有3个mysql表:
unsubscribers
=> (id, email)
bounces
=> (id, email, bounce_reason)
blacklists
=> (id, domain)
假设我们必须搜索电子邮件ID:something@someone.com
和域名:someone.com
(即电子邮件ID)
我想写一个搜索Email ID
或unsubscribers
中存在的bounces
或domain
中存在的blacklists
所以,如果这些表中存在电子邮件ID或域,我应该得到1或0的结果。如果这不可能,至少我应该得到数据
提前感谢您的帮助
答案 0 :(得分:0)
我找到了解决方案。下面的查询全部完成
SELECT (SELECT count(`email`) FROM `unsubscribers` WHERE `email` = 'rsakhale@gmail.com') AS `unsubscribers`,
(SELECT count(`email`) FROM `bounces` WHERE `email` = 'rsakhale@gmail.com') AS `bounces`,
(SELECT count(`name`) FROM `blacklists` WHERE `name` = 'gmail.com') AS `blacklists`
它返回
+---------------+---------+------------+
| unsubscribers | bounces | blacklists |
+---------------+---------+------------+
| 1 | 0 | 0 |
+---------------+---------+------------+
啊,这是一个菜鸟问题:'(