|
Posted by Paul Lautman on 06/14/06 17:50
Chris wrote:
> I have a set of nested links, and at one time each category one had
> all the same subcategories. Now that has changed - each category has
> different subcategories. I have a tree menu, but now it just shows
> all subs under each category, of course. I have 2 tables - one for
> categories, one for subcategories - they are related by the
> categoryID. I think I have the SQL fine (have tried several
> different versions - see most recent/uncluttered below), but how do I
> get it to work correctly in the tree loop?
> SELECT DISTINCT cat.catName, cat.catDesc, subcat.subcatName
> FROM cat, subcat
> WHERE cat.catID = subcat.catID;
>
> Tree example:
> cat.catName(1)
> subcat.subcatName(1)
> subcat.subcatName(2)
>
> cat.catName(2)
> subcat.subcatName(3)
> subcat.subcatName(4)
>
>
> I'm sure it must be simple, and I'm just having a slow brain day...
>
> Thanks,
> Chris
Does this help:
http://dev.mysql.com/tech-resources/articles/hierarchical-data.html
Navigation:
[Reply to this message]
|