andrew_biggart Posted May 11, 2010 Share Posted May 11, 2010 Ok what I would like to do is... At the minute I have a forum, I would like to count the number of comments each thread has and display them in order of the one with the most comments at the top. The comments and threads are in two different tables but are linked by the thread ID. How would I go about doing this? Link to comment https://forums.phpfreaks.com/topic/201374-creating-a-most-popular-section/ Share on other sites More sharing options...
andrewgauger Posted May 11, 2010 Share Posted May 11, 2010 SELECT a.threadID, count(*) FROM posts as a JOIN comments as b ON (b.threadID = a.threadID) GROUP BY count(*) Link to comment https://forums.phpfreaks.com/topic/201374-creating-a-most-popular-section/#findComment-1056607 Share on other sites More sharing options...
andrew_biggart Posted May 11, 2010 Author Share Posted May 11, 2010 Could you break it down a little please I dont understand! Link to comment https://forums.phpfreaks.com/topic/201374-creating-a-most-popular-section/#findComment-1056616 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.