0
Select A.SubscriberKey, A.EventDate,B.CreatedDate
From _Click A
JOIN _ListSubscribers B
ON A.SubscriberKey = B.SubscriberKey
Where B.ListID = '10630' AND B.CreatedDate > (Select DATEADD(day,-180,getdate())) AND A.EventDate IS NULL
Group By A.SubscriberKey,B.CreatedDate, A.EventDate

目前,没有任何东西被退回。我想返回订阅者订阅者密钥(这是他们的电子邮件)、事件日期(点击发生的日期)以及他们没有点击任何内容时的添加日期(创建日期)。谁能帮我指出正确的方向?感谢大家!

4

2 回答 2

1

尝试:

SELECT A.SubscriberKey, A.EventDate, B.CreatedDate 
FROM _Click A, _ListSubscribers B 
WHERE A.SubscriberKey(+) = B.SubscriberKey 
AND B.ListID = '10630' 
AND B.CreatedDate > (Select DATEADD(day,-180,getdate())) 
AND nvl(A.EventDate,null) IS NULL 
GROUP BY A.SubscriberKey,B.CreatedDate, A.EventDate
于 2012-06-27T16:53:39.427 回答
0

在这种情况下,我看不到 GROUP BY 的目的。您没有进行任何聚合。

我相信这会给你正在寻找的结果。

select SubscriberKey,
       null as EventDate,
       CreatedDate
  from _ListSubscribers ls
 where ListID='10630'
   and CreatedDate > DateAdd( day, -180, getdate())
   and not exists( select 1 from _Click c where c.SubscriberKey = B.SubscriberKey )

以下使用外连接的查询应该给出相同的结果,并且它更类似于您的原始查询。

select ls.SubscriberKey,
       c.EventDate,
       ls.CreatedDate
  from _ListSubscribers ls
  left outer join _Click c
    on c.SubscriberKey = ls.SubscriberKey
 where ListID='10630'
   and CreatedDate > DateAdd( day, -180, getdate())
   and c.EventDate is null
于 2012-06-27T17:58:48.913 回答