All we need is an easy explanation of the problem, so here it is.
I know I can add text to all fields using this SQL query
update oc_product set sku= CONCAT('BBC', sku);
but I need it to only add if the field does not contain BBC in it.
As all SKU is added on auto and I am unable to change the way they are added to my DB so I need to do it manually every day.
thanks in advance for any help.
I need to only add BBC to those where it is not listed using phpmyadmin.
How to solve :
I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.
Just use a
where clause. If you are looking for
'BBC' anywhere in the string, then:
update oc_product set sku = CONCAT('BBC', sku) where sku not like '%BBC%';
If you are only looking for
'BBC' at the beginning of the string, then:
update oc_product set sku = CONCAT('BBC', sku) where sku not like 'BBC%';
Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂