I have 3 tables:
Each time a post gets visited, a new visit will be inserted in the following format:
| id | post_id
My post table has:
| id | text | user_id ...
I'm trying to retrieve the TOP 5 users with the most views on their posts in total. For example:
- User1 -> 4
- User2 -> 2
SELECT count(v.id) AS count FROM visits AS v RIGHT JOIN pastes AS p ON v.post_id = p.id RIGHT JOIN users AS u ON id = p.id
But all I get is an array with "count: 12".