I'm having trouble figuring out the most logical way to clone parent / child product categories for another company.
There are 3 levels of categories.
i.e. Mens Clothing(L1)> Shirt(L2)> Short Sleeve(L3)
( Shirtis the parent element Short Sleeve, but Mens Clothingis the parent Shirt)
ParentCategoryIdis the category identifier immediately above.
ParentStringis the identifier of all categories above, in level order.
(i.e., for the product L3, it will be Id for L1, then Id for L2)
The table setting is as follows.
CREATE TABLE
(
CategoryId INT
,CompanyId INT
,ParentCategoryId INT
,CategoryName VARCHAR(255)
,ParentString VARCHAR(20)
)
INSERT INTO
(123, 12, NULL, 'Mens Clothing', NULL),
(124, 12, 123, 'Shirt', '123-'),
(125, 12, NULL, 'Womens Clothing', NULL),
(126, 12, 125, 'Shirt', '125-'),
(127, 12, 124, 'Short Sleeve', '123-124-'),
(128, 12, NULL, 'Drinks', NULL),
(129, 12, 128, 'Water', '128-')
I need to copy all categories and levels to CompanyId13.