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

現在、何も返されていません。サブスクライバーSubscriberKey(電子メール)、EventDate(クリックが発生した日付)、および何もクリックしなかったときに追加された日付(CreatedDate)を返したいです。誰かが私を正しい方向に向けるのを手伝ってもらえますか?みんな、ありがとう!

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

この場合、GROUPBYの目的はわかりません。集計は行っていません。

これであなたが探している結果が得られると思います。

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 に答える