SELECT votes object_id COUNT FROM votes INNER JOIN blog_post ON votes

1
2
3
4
5
6
SELECT votes.object_id, COUNT(*)
FROM votes
INNER JOIN blog_post
ON votes.object_id = blog_post.id
WHERE CURRENT_DATE -7 < blog_post.date and blog_post.date < CURRENT_TIMESTAMP
GROUP_BY object_id;