Reputation: 21
select email, users left join clicks cl on c.campaign_key = cl.campaign_key where datediff(c.Email_drop_date,cl.click_date) < 10
Upvotes: 0
Views: 38
Reputation: 1271211
If you want the number of clicks per campaign, I would expect:
select c.campaign_key, count(cl.click_date)
from campaign c left join
clicks cl
on c.campaign_key = cl.campaign_key
where cl.click_date >= c.Email_drop_date and
cl.click_date < date_add(c.Email_drop_date, interval 10 day)
group by c.campaign_key;
Upvotes: 1