I have a mysql database table where I need to add the prefix "35-" to all values of a certain column/field (productcode
) whose category
number is higher tahn 500. So I would for example want productcode value 123A56B789
be changed to 35-123A56B789
, and similar in all other rows of the table.
An additional problem is that this column is the primary key of that table, but I tried to work around that by adding an additional index column, defining that as the primary key, erasing the index on "productcode" and trying the following query (with the intention to later define it as a primary index again):
UPDATE my_table
SET productcode = '35-' + productcode
WHERE category >= 500
I get no error or warning messages (even a message "xxxx rows affected"), but there is no visible effect whatsoever - the productcodes stay the same as they were before.
Is there a method to achieve this directly in MYSQL?