Hello
I have 3 table in my MySQL database:
articles
users
comments
I want to sort the articles by "Most Comments".
I'm using this SQL but it's not working:
SELECT
art.title,
art.sent_time,
art.total_readers,
art.articleID,
users.full_name,
users.user_id,
COUNT(comments.commentID) AS totalComments
FROM
`articles_users` AS art,
`users` AS users,
`articles_users_comments` AS comments
WHERE
art.user_id = users.user_id
AND comments.articleID = art.articleID
AND art.approved =1
GROUP BY comments.commentID
ORDER BY totalComments ASC
Can anyone help me plz?