Okay, it turns out to be more than that. I have a category/sub-category relationship. So what I need is to concatanate the category-subcat names as the returned value like "catname-subcatname".
I tried this but get an 'unknown column categories' error
Code:
select t1.forumid,
GROUP_CONCAT(cat.catname) AS categories,
CONCAT(categories, '-', subcatname) AS fullcatname
from forums as t1
INNER JOIN forumsubcats as t2
ON t2.forumid = t1.forumid
INNER JOIN subcats as t3
ON t2.subcatid = t3.subcatid
INNER
JOIN categories AS cat
ON cat.categoryid = t3.categoryid
GROUP
BY t1.forumid
Then once I get that working, I need to combine it with the other query to get the record count of another sub table as count. When I tried to incorporate that, it breaks the category query that I had. I think it's because of the group by, not quite sure how to handle multiple group by statements.
Any help would be appreciated. If that's not clear, let me know. Basically the structure is
Code:
forums as t1 - forumid
forumsubcats as t2 - forumid, subcatid
subcats as t3 - subcatid, categoryid, subcatname
categories as cat - categoryid, catname
then the other table that I need to get the count from is called
posts as p - postid, forumid
Bookmarks