|
Posted by frizzle on 09/28/91 11:36
Hi there,
Still building my forum.
I have a certain mysql-query i just can't figure out.
These are my tables (simplified):
categories -> id, description
forums -> id, cat_id, description
threads -> id, forum_id, date, title, text
I suppose each speaks for itself.
What i want is below, but i just somehow cannot fix the query. I've
tried AND, GROUP BY, etc.
Table Contents:
Table 'categories'
- id - description
1 Category One
2 Category Two
3 Category Three
Table 'forums'
- id - cat_id - description
1 1 Forum 1
2 2 Second Forum
3 3 Another Forum in
category two!
Table 'threads'
- id - forum_id etc.
dozens of records.
What i need as an output is the following:
***************************************
Category One
--> Forum 1 4567 threads
--> Second Forum 867 threads
Category Two
--> Another Forum in category two! 67 threads
Category Three
--> Sorry, no forums at the moment.
***************************************
I hope it's clear. I need to get the Categories first,
then the forums belonging to them (grouped with them)
and then the number of threads belonging to those forums. ( Count() )
Greetings.
[Back to original message]
|