Welcome to WebmasterWorld Guest from 22.214.171.124
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 ....
SELECT DISTINCT A.name, A.id, A.parent, COUNT(B.id) FROM categories AS A LEFT JOIN categories AS B ON A.id = B.parent WHERE A.id = B.parent AND A.parent = 1 GROUP BY B.parent
Any good resources on this kind of thing?
That works to an extent. It pulls all the ones with children. Lets say for example I have cats of
====left blue spotty
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
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 :)