-1

I am very new to MySql and I am having a lot of trouble with the syntax. I am looking for a query that will do the following.

if string 'abc' is present in any row of column 'X', then insert string 'def' into column 'Y', only in the same rows that contain 'abc' in column 'X'.

I have tried a few different statements but i continue to receive syntax errors. Hopefully I have explained this clearly enough in pseudo

chris85
  • 23,846
  • 7
  • 34
  • 51

1 Answers1

0

Try to use this query (plz change tablename, column X,Y):

update tablename set Y='def' where X like '%abc%';
Vikas Umrao
  • 2,800
  • 1
  • 15
  • 23