cpat21
cpat21

Reputation: 21

MySQL - return users that signed up within 10 days

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

Answers (1)

Gordon Linoff
Gordon Linoff

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

Related Questions