Jump to content


adding a string to data already in the database

  • Please log in to reply
1 reply to this topic

#1 coolispaul

  • Members
  • Pip
  • Newbie
  • 1 posts

Posted 20 January 2006 - 02:29 PM


does anybody know if there is a function that i can use to prepend a string to data in every row of a particular field in the database.

The problem i have is that i have a field called 'images' which contains the name of the image. However, i need to put the path to it before the name. So just want to add the path in to every row.


#2 fenway

  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 20 January 2006 - 06:41 PM

Try the following:

UPDATE yourTable SET col1 = CONCAT('string to prepend',col1);

Hope that helps.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users