user5749981
user5749981

Reputation:

CONCAT substring

I have a table which carries around 172 entries, with different column names, however I want to update all of them with a simple query. I have a name entered in the name column (http://prntscr.com/j9qeg6)

I would like to replace the III with I've using a simple query, Now I've been checking and trying however it does not seem to work. I used the following query which got me closest to the result however its not working.

UPDATE item_template SET name = CONCAT("IV", SUBSTRING(name, LENGTH("III ")+1));

Does anyone have an idea on this?

Upvotes: 0

Views: 348

Answers (1)

D-Shih
D-Shih

Reputation: 46219

Apostrophe ' instead of Double quotes "

You can try use REPLACE function.

UPDATE item_template 
SET name = REPLACE(name, ' III', ' IV');

sqlfiddle:http://sqlfiddle.com/#!9/b4b8d6/1

Upvotes: 1

Related Questions