Str_Replace in SQL statement
Posted on 2005-04-01
I have a lot of movies in a table. The titles of the movies are in the format "The Rock" without the quotes. I want to reverse the title to "Rock, The" without the quotes.
Note that I need to change the value in the field, it's not a string like in the examples at mysql.com.
Now I have this, but I do not know if this would/could work:
UPDATE movies SET title = REPLACE(title,'do-something-here','do-something-here');
Or maybe this:
UPDATE movies SET title = SUBSTRING_INDEX(title,'The ',1);
Anyway, Im stuck :-/
Thanks in advance,