I have a dataset with these columns:
- Date
- Code
- Link
- Clicks
Each code represents a person, and my goal is to find the first date someone posted each link and how many clicks each link has. To be considered a legitimate post, a link must have a total of at least 100 clicks. This query ALMOST does what I need:
select
min(date) as post_date,
max(date) as last_click,
link,
code,
sum(clicks) as clicks
from table1
where date >= '2017-01-01'
group by link, code
having sum(clicks) > 100
The problem is this query is giving me the first date ANY clicks registered for links with 100+ clicks. For example:
PersonA got 1 click for linkA on January 1st. On January 7th linkA reaches a total of 100+ clicks. Right now this query is returning January 1st, when I need it to return January 7th.
I hope I was clear enough (again very new to this). Any help would be GREATLY appreciated! :)