I am trying to get a total unique number of click-throughs for given email campaigns. A unique click-trough being a unique URL clicked by a unique user. I need to be able to do this in a single query. The database structure is something like:
id
campaign_id
url_id
user_id
I've been playing round but haven't been able to get this working. E.g.
SELECT COUNT(DISTINCT url_id) FROM click_throughs WHERE campaign_id=24 GROUP BY user_id
I would need the sum of the results set this returns. But I effectively just want a single value returning.
Start Free Trial