I have a 2 tables one that holds categories and sub cats
so the structure is
CategoryTBL --
CatID int,
ParentCatID int ,
CatName varchar(100)
values
1001 | 1002,
1000 |1001,
Cat1 | Cat2
Table 2 is where i hold all the products against a CatID
the structure is
CatID ,
ProductID
what i need to do is for each child category calulate all the products and the higher up you go in the parent id it sums up the count
example say Planes has 3 child categories (each with 20 products) i want the planes category to be the sum of the 3 so 60 can someone show me how to do this
i will be running this procedure one a day
im on sql 2000 but will be going to sql 2005.
so the structure is
CategoryTBL --
CatID int,
ParentCatID int ,
CatName varchar(100)
values
1001 | 1002,
1000 |1001,
Cat1 | Cat2
Table 2 is where i hold all the products against a CatID
the structure is
CatID ,
ProductID
what i need to do is for each child category calulate all the products and the higher up you go in the parent id it sums up the count
example say Planes has 3 child categories (each with 20 products) i want the planes category to be the sum of the 3 so 60 can someone show me how to do this
i will be running this procedure one a day
im on sql 2000 but will be going to sql 2005.