Answered
Cascading Record Update
Hello,
I have a table in my ecommerce application with the following fields:
categoryID
categoryParentID
categoryTitle
categoryActive
The categoryParentID is the categoryID of the corresponding parent category in the hierarchy of categories and there could be a potentially unlimited number of sub category tiers.
For example:
Category A
-Category A-1
-Category A-2
--Category A-2-1
--Category A-2-2
---Category A-2-2-1
---etc
Category B
-Category B-1
-Category B-2
Category C
-Category C-1
-Category C-2
It is possible to disable a category by changing the value in the categoryActive column to zero. However, I would like to be able to cascade this update to all corresponding sub categories. For example, if I disable Category A, the status of all corresponding sub categories would be changed to zero too.
Does anyone know the best way to achieve this? I'm sure this must be a common problem, but I'm totally stuck!
Many thanks in advance for your assistance,
Simon
I have a table in my ecommerce application with the following fields:
categoryID
categoryParentID
categoryTitle
categoryActive
The categoryParentID is the categoryID of the corresponding parent category in the hierarchy of categories and there could be a potentially unlimited number of sub category tiers.
For example:
Category A
-Category A-1
-Category A-2
--Category A-2-1
--Category A-2-2
---Category A-2-2-1
---etc
Category B
-Category B-1
-Category B-2
Category C
-Category C-1
-Category C-2
It is possible to disable a category by changing the value in the categoryActive column to zero. However, I would like to be able to cascade this update to all corresponding sub categories. For example, if I disable Category A, the status of all corresponding sub categories would be changed to zero too.
Does anyone know the best way to achieve this? I'm sure this must be a common problem, but I'm totally stuck!
Many thanks in advance for your assistance,
Simon
