Skip to content
Advertisement

replace column with other column if value is ABC*

MYSQL PHPmyAdmin

I have a table “photo” I have a column named “column_title” (varchar(300)) and a column named “column_description” (text).

The title is sometimes ABC and a number. Sometimes ABC and more letters. ABC1, ABC2, ABC9999, … ABCDEFG745G

i want to replace each “column_title” with “column_description” if the value is starting with “ABC” (and a number after).

UPDATE photos
SET variable = 'column_title', variable = 'column_description'
WHERE column_title = ABC%;

Advertisement

Answer

I think you need LIKE operator :

UPDATE photos
  SET column_title = column_description 
WHERE column_title LIKE 'ABC%';
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement