
January 6th, 2003, 04:18 AM
|
|
Junior Member
|
|
Join Date: Jan 2003
Location: South Africa
Posts: 2
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
SQL Trees
Hi there
I have a table that holds categories and another table that holds products.
In the category table, i have a parent and parent-child categories, at the moment, a parent can have max. of 2 children.
In the products table i have a foreign key reference any of the categoryID in the category table.
Now I would like do delete a category. If I delete a parent category, then all the products that reference the categoryid are replaced by a permanent misc. categoryid. On the other hand if a child-category is deleted, then the products are shifted one-up to the the parent category of the deleted category.
Could you help me with the delete and maybe updating of the category and products SQL queries.
Thanks in advance!
|