How to alter images/ to assets/images in MySQL data? -


I have the following table with the data.

  create a table, otherwise the 'omc_product' (`id`int (11) tap etounment,` name 'varchar (255) null,' short disk varchar (255) not faucet, longscene text 'Thumbnail' varchar (255), image 'varchar (255) not tap, `class' varchar (255) default faucet, ... ... primary key (` id`)) engine = mesam default charge = Latin1 AUTO_INCREMENT = 121; - - Data dumping data for 'omc_product` -' omc_product` (`id`,` name`, `short disk ',` long dcc`, `thumbnail`,` image`, `class`,' grouping 'included Do, `condition` 'Jpg', 'newflight', 'imagebox-new', 'active', 5, '', 'none', 0.00), (2, 'ginny', 'new flight ginny', '', 'images / new 3, 'Trahas', 'Flight', 'New, Flight', 'Image Box-New', 'Active', 5, '', 'None', 0.00), 'Images / New Flight.jpg', 'Images / New Flight_Genny_big 1.jpg' 'Dit Hammellige Estates: Tray 'Im', '', 'image / treahs_sml.jpg', 'images / traheas.jpg', 'det-hacklelegest-institutional', 'imagebank-elect', 'active', 5, '', 'none' 0.00), (4) 'Anima Halloween', 'Folgate Feg & Culture ...  

There are images in the thumbnail and all areas of the image / in the beginning.

Now I need to include the property / property in front of all of these images.

For the exam

< / P>

Can anyone tell me How is that to do this?

P> Thanks in advance.

Try it out:

  UPDATE omc_product SET image = CONCAT (' Property / ', image), thumbnail = CONCAT (' assets '', thumbnail)  

,

If you have to do it more than once, Solutions are more 'safe':

As Bobby has mentioned in his comment, you can add a WHERE section to not change those methods already Only property :

  UPDATE omc_product SET image = CONCAT (' Property / ', image), thumbnail = CONCAT (' property / ', thumbnail) where the thumbnail' property% 'is not liked and the image' property% 'is not liked  

But in T you can not add either image or thumbnail to property if it is only missing in one field.

Another solution may be:

  UPDATE omc_product SET image = if (image 'property%', CONCAT ('property /', image), image) Not thumbnail = if (thumbnail ' 

but note that it updates every line in your DB, even if it does not need to be updated.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -