In the incoming_links
table, what exactly the created_at
column means?
I’d like to create a badge similar to a Good Share, i.e.:
select views.user_id, i2.post_id, current_timestamp as granted_at
from (
select i.user_id, min(i.id) i_id
from incoming_links i
join badge_posts p on p.id = i.post_id
join users u on u.id = i.user_id
group by i.user_id, i.post_id
having count(*) >= 300
) as views
join incoming_links i2 on i2.id = views.i_id
… but I’d like to only count “clicks” in the same year where the post linked to was created.
Will I solve this problem by simply adding a WHERE clause that makes sure that the year of incoming_links.created_at
is the same as the year of badge_posts.created_at
? Or will this WHERE clause mean something else?