i have users
table and i have posts
table i want select from users
the top users that have the big amount of posts from posts
table and order them by numbers of posts
i can make it by array_count_values()
by i cant order it
now i think if i make it by one mysql query by left and join will be more better
table structure
posts
id | auther_id
i tried this
SELECT COUNT(1) cnt, u.user_id
FROM users u
LEFT JOIN posts p
ON p.author_id=u.user_id
GROUP BY u.user_id
ORDER BY cnt DESC
LIMIT 20
it gave me this
see the arrow
what is this
i just have 2 posts under user_id 5
what is this first row