I have this table forum and topic and i want to query forumname, description, total topics in the Forum idk how to do this

i tried an sql statement like this

SELECT f.forumname,f.forumdesc,max(t.forum) as total_topics from Forum as f INNER JOIN Topic as t WHERE f.forumid = t.forumid;

of course this did not work it returns only a single tuple like
|forumname|forumdesc |total_topics
|PHP |description here| 100

the number 100 in total_topics are the total number of all topics in the database;

the output i want is a list of all forums with there corresponding names,description and the total number of topics in each forum...

for now i have created a function in php to get the total number of topics in a forum but maybe its better if i can query 1 table for all of those information I want, if its possible. . .

thanks!

SELECT f.forumname,f.forumdesc,count(*) as total_topics from Forum as f 
INNER JOIN Topic as t WHERE f.forumid = t.forumid
group by f.forumname,f.forumdesc;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.