You need to add a constraint that connects the corresponding rows of each table. I'd have to see your DB schema to give you an exact answer, but it will probably be something like... WHERE categories.category_id = forums.category_id
This goes between your FROM and ORDER BY clauses.