bypass mysql no-subqueries

wxdqz

New Member
I'm attempting to code a forum and am having a little trouble deciding whether the following is possible with mySQL since mySQL has no subquery support.

On the main page of my forum, i would like to give a list of forums, next to each forum should have the name of the forum, the number of threads, and the number of messages.

I have the following tables:
forum_forums
forum_threads
forum_msgs

forum_forums has forumID
forum_threads has threadID and forumID
forum_msgs has msgID and threadID

Basically, i'd like to do a COUNT of msgID grouped by forumID (having to go thru threadID) and a COUNT of threadID grouped by forumID.

Is this possible to do in one query statement using joins and group by's? Or am i going to have to separate it out into separate queries? Any sample SQL code would be helpful =) Thanks. [I should really practice my joins]
 
Back
Top