How can i change the product category and sub-category?

Hi all,
I have some product categories, under that some sub-categories are there… These are stored in the database ‘cat’ table,‘subcat’ table and the products are to be stored in the ‘prod’ table…

Now i found that, some sub-categories are not exactly in the earlier specified category…

For that i want to change the category and respective sub-category…

If i change,i want to change automatically the ‘prod’ table products also change based on the recent changes…that to programatically, not to go for database tables…

Help me regarding this problem…

it’s not clear what your database tables look like and what you need to be done.

For example, can you clarify what

Now i found that, some sub-categories are not exactly in the earlier specified category…

For that i want to change the category and respective sub-category…

means.

If you post your table structures for cat, subcat and prod along with which columns are PK’s and FK’s and the sql you have so far to edit records it would be easier to help you.

Earlier:::
cat1–>subcat1
cat2–>subcat2

now i found that are not related exactly… New one is:

cat1–>subcat2
cat2–>subcat1

Cat table:::
c_id and c_name columns.
subcat table::
s_id and c_name and s_name columns…

Prod table::
pid,pname,desc,c_name and s_name columns.

But there is no primary and foreign keys…
Already it is developed 3 years back…Now the data is more, to handle that some changes we want…

ok, since your data in the database is corrupted I think all you can do is go in manually and use sql’s update statement to correct the corrupted records in each table.

But the bigger issue here is how was your database corrupted in the first place which I would hope you will look into if you haven’t already sorted that out.

I’m not sure your current db structure is the best it could be, but that is another issue and one that you might consider looking into after you correct the table data.