I've created my own forum and would like to display
username - from users table
title - form topics table and
a count of comments - from replies table
I 've got the first bit sorted ok
SELECT username, title
FROM users, topics
WHERE users.userid = topics.userid
ORDER BY RAND()
I now want to add a count of the comments associated with each topic, something of the order of
SELECT COUNT(replies.comment) AS 'count'
WHERE topics.topicid = replies.topicID
GROUP BY topics.title
I would have assumed I'd do a LEFT JOIN ON topics.topicid = replies.topicID, but this doesn't seem to work. I've tried various combinations of the query but I can't get it to function. Any ideas.