JOIN/GROUP returning single row

admin

Administrator
Staff member
I am trying to select all the data from one table, and the number of rows in a second table associated with each row in the first. The problem is that the query is only returning one row. Here's my query:

"SELECT forum.*, count(topic.topicId) as tcount from forum left join topic on forum.forumId=topic.forumId GROUP BY topic.forumId"

it works, but only for the first row in the forum table. I assume I'm doing something wrong. Anyone know what?
 
Back
Top