I need SQL query for MySQL to select top 10 people with most followers
my table
id | user_id | follow_id 1 3 6 2 3 7 3 4 6 4 5 6 5 7 3 6 9 7
From example user with id 6 have 3 time followed , 7->2 and 3->1, so TOP 10 will be
user with id 6,7,3 ...
SELECT `follow_id`, COUNT(1) AS `followers`
FROM `tbl`
GROUP BY `follow_id`
ORDER BY COUNT(1) DESC
LIMIT 10;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With