mysql - Insert based on conditions -
i trying insert data in mysql table. have option in opencart option_id = 6, want insert products containing option_id=6 new option option_id=9.
insert oc_product_option (`option_id`) select 9 (select `option_id` oc_product_option `option_id` == 6);
is not working. how can give condition in opencart?
edit: here more information. have 1 option color 1 assigned thousands of products. trying assign color 2 products containing color 1.
- color1- option id = 6
- color2- option id = 9
in opencart, mysql db tables oc_product_option , oc_product_option_value.
in oc_product_option have fields product_id, product_option_id(auto incremental-no need update), option_id
so doing selecting option id of color 2 -9 , assigning products option id = 6
if got right query must like:
insert oc_product_option (`product_id`,`option_id`) select product_id,9 oc_product_option `option_id` = 6;
Comments
Post a Comment