When I add a A
category, and add a X
product with the A
category (categories table), after that it will edit the category name A
to category B
, the category of product X
(table products) remains with the category A
.
My update query is
UPDATE Categorias set Categoria = @Categoria WHERE IDCatg = @IDCatg
Basically, when the A
category was edited (categories table), check if there is any product with the category A
(table products), and in addition to updating to A
category for B
, edit the product category X
to B
. If the category is not in any product, edit normally, for that purpose the query described above.