MySQL Forums
Forum List  »  Newbie

Re: How to update a group of entries
Posted by: Bill Karwin
Date: October 19, 2006 08:58PM

You can find the rows to change using regular expressions:

UPDATE products SET image = ... WHERE image RLIKE '[a-z]+-[0-9]+.jpg'

You can use various string functions like LOCATE() and SUBSTRING() to find the parts of the name that you want to keep. It's going to be awkward.

Or you can do it in a script. Fetch the values, manipulate them with some more featureful string-handling language like Perl or PHP, and then use UPDATE to set the values back into the database.

Bill K.

Options: ReplyQuote

Written By
October 19, 2006 06:33PM
Re: How to update a group of entries
October 19, 2006 08:58PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.