Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- nested loop, 2 MySQL tables
June 14, 2006, 5:25 pm
rate this thread
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;
I'm sure it must be simple, and I'm just having a slow brain day...
Re: nested loop, 2 MySQL tables
Does this help: