Quote:
|
Originally Posted by r937
your database is fine
when you send a catID, the query that you run should return not only products in that category, but also products in that category's subcategories ...
Code:
/* programs attached to the category */
select cat.catID
, cat.catName
, programs.programname
from categories as cat
left outer
join programs
on cat.catID
= programs.catID
where cat.catID = 937
union all
/* programs attached to the subcategory */
select subcat.catID
, subcat.catName
, programs.programname
from categories as cat
left outer
join categories as subcat
on cat.catID
= subcat.catParent
left outer
join programs
on subcat.catID
= programs.catID
where cat.catID = 937
|
Thank you for your reply! I'm playing with the query seeing if I can get it to work... however there are no products with the category set to a main category. What I mean is, only the subcategorycode is stored with the product, so if I send say categoryCode=1 (that is the categorycode for magic), I need to get all the products whose subcategorycode's PARENT is 1. this is really confusing, so if the query you gave me does that I'm not seeing it

i will keep playing with it but if I need to do something different I would appreciate the informaiton! thanks again!
-Selarom