do you have threads at each of those three levels, and do you want to select all threads at each of those levels?
if so, something like this --
Code:
select L1.name as name1
, L2.name as name2
, L3.name as name3
, threads.title as threadtitle
from subcats as L1
inner
join subcats as L2
on L1.id = L2.parent_catid
inner
join subcats as L3
on L2.id = L3.parent_catid
inner
join threads
on L3.id = threads.subcatid
where L1.parent_catid is null
union all
select L1.name as name1
, L2.name as name2
, null
, threads.title as threadtitle
from subcats as L1
inner
join subcats as L2
on L1.id = L2.parent_catid
inner
join threads
on L2.id = threads.subcatid
where L1.parent_catid is null
union all
select L1.name as name1
, null
, null
, threads.title as threadtitle
from subcats as L1
inner
join threads
on L1.id = threads.subcatid
where L1.parent_catid is null
order
by 1
, 2
, 3
, 4
Bookmarks