Zen Follower
- Join Date:
- Aug 2006
- Posts:
- 136
- Plugin Contributions:
- 0
How do I use SQL to update many categories_id values in products_to_categories?
Within the products_to_categories table, I need to change too many categories_id values from 25 to 26. It would be easy if ALL 25s were to be changed but only some of them need to be changed. I thought I had done this before because I have in my "working mysql scripts" folder the following snippet of code:
UPDATEzen_products_to_categoriesSETcategories_id= '26' WHERE (products_id, categories_id) = '434', '25';
UPDATEzen_products_to_categoriesSETcategories_id= '26' WHERE (products_id, categories_id) = '435', '25';
UPDATEzen_products_to_categoriesSETcategories_id= '26' WHERE (products_id, categories_id) = '439', '25';
Unfortunately, I am getting the following SQL error message:
ErrorSQL query:
UPDATE
zen_products_to_categoriesSETcategories_id= '26' WHERE (
products_id,
categories_id
) = '434',
'25';MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' '25'' at line 1
What is the proper SQL code (MySQL version is "5.0.81-community")? Do I need to include database/table names in some manner and if so, how do I do that again?
Thank you!