基于某个值是否存在于另一个不相关的记录中的自定义输出列 table

Custom output column based on whether a value exists in any record of another, unrelated table

我有一堆 table,我正在尝试从它们中提取各种信息。我需要的信息之一是客户是否订阅了时事通讯,但除了电子邮件地址之外,两个 table 之间没有链接数据。因此,我试图显示一个自定义列(例如 SubscribedToNewsletter),它显示 Subscriptions.Email 值(即 True/False)中是否存在客户的电子邮件地址。

Customer
===============
Email

Subscriptions  
===============
Email

我尝试过使用 CASEEXISTS 尝试根据另一个 table 的列中是否存在某个值来伪造自定义列,但事实并非如此生产任何水果。

SELECT 
CASE WHEN Subscriptions.Email = Customer.Email THEN 'True' ELSE 'False' END
FROM Customer
INNER JOIN Subscriptions ON 1=1
WHERE EXISTS (SELECT 1 FROM Customer WHERE Subscriptions.Email = Customer.Email)

使用相关子查询来计算每个客户的订阅数:

select c.*,
       case when (select count(*) from Subscriptions s
                  where s.Email = c.Email) > 0 then 'True'
            else 'False'
       end
from customers c