|
Posted by lorento on 06/15/06 07:49
SELECT cat.catName, cat.catDesc, subcat.subcatName
FROM cat
LEFT JOIN subcat ON subcat.catID = cat.catID
ORDER BY catID ASC
--
http://blog.deshot.com
http://www.padbuilder.com
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
Navigation:
[Reply to this message]
|