Forum Moderators: coopster
Is it possible to do a self join using aliasses to get that info in one swoop.
SELECT name, id, parent
FROM categories AS A
LEFT JOIN categories AS B ON A.id = B.parent
GROUP BY B.parent
(i have just edited this 10 times as each time looks even worse)
any assistance will be appreciated and may result in a beer at Pubcon ....
That works to an extent. It pulls all the ones with children. Lets say for example I have cats of
left
right
bottom
==left green
==left blue
====left blue spotty
==right green
==right orange
No the query above only pulls the ones with children. I still need the the values to show even if no children are present so that the cat still shows.
So at the moment theabove query shows
name¦ count
left¦ 2
right¦ 2
left blue ¦ 1
When what I would want it to show is the names ,left, right botton and their appropriate children cound then do the same on the fly each time a sub cat is selected.
Is this making sense :)