• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
mySQL count question

#5
[eluser]cinoob[/eluser]
I think I have managed to get quite close now. I have got the count for all topics messages but this SQL statement does not include the topics that do not yet have any messages:

Code:
$query = $this->db->query('SELECT forumtopics.id AS topicid, forumtopics.*,
COUNT(forummessages.topic_id) AS total_replies FROM forummessages, forumtopics
WHERE forummessages.topic_id = forumtopics.id  AND forumtopics.category_id =
'.$this->uri->segment(3).' GROUP BY forummessages.topic_id');

Any ideas how I can amend this statement to retrieve all topics that have a count of 0 messages?


Messages In This Thread
mySQL count question - by El Forum - 12-30-2009, 01:00 PM
mySQL count question - by El Forum - 12-30-2009, 01:06 PM
mySQL count question - by El Forum - 12-30-2009, 04:33 PM
mySQL count question - by El Forum - 12-30-2009, 05:44 PM
mySQL count question - by El Forum - 12-30-2009, 06:27 PM
mySQL count question - by El Forum - 12-30-2009, 09:05 PM
mySQL count question - by El Forum - 12-30-2009, 10:28 PM
mySQL count question - by El Forum - 12-31-2009, 06:45 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.