SELECT * FROM articles INNER JOIN comments ON articles.artid = comments.artid ORDER BY MAX(comments.artid) LIMIT 10
I am trying to fetch top 10 articles that have higher comments
But this fetch only one records
What do you want to achieve with the "order by max" that's not correct.
Try
...ORDER BY comments.artid DESC LIMIT 10
instead....
I resolved it like this
SELECT * FROM bhl_contents INNER JOIN bhl_comments ON bhl_contents.artid = bhl_comments.artid GROUP BY bhl_comments.artid ORDER BY COUNT(bhl_comments.artid) DESC LIMIT 10