Most liked posts?
daltonsutton opened this issue · comments
Dalton Sutton commented
How would I go about getting the most liked posts? I've tried a few different queries but couldn't get anything working correctly. Thanks in advance for any help!
Graham Washbrook commented
This query could start you in the right direction. Returns the post_id with associated number of likes - most liked first.
SELECT
`likeable_id` AS post_id,
COUNT(*) AS n_likes
FROM
`likers`
WHERE
`likeable_type` LIKE '%Post'
GROUP BY
`likeable_id`
ORDER BY
n_likes
DESC
stale commented
This issue has been automatically closed because it has not had any recent activity. 😨