Page 1 of 1

appending to an existing field in a record

Posted: Sat May 24, 2003 11:15 pm
by robin1
Hello everybody,
how do go about appending to a field. not over ride or replace the content of a field but rather add to the current content of a field..
tried the following but it replaces the content insted of adding to the information that already there.

update dbt_customer1 set dbprob_userfix = 'testing1' where dbcust_id = '19

is there a sql command i can use or do i have to put put the info. from the database field to a variable and and the new info to a sec. variable and add both variable in to a third variable re-update the field..

any help you can give me would be greatly appreciated.

8O

Posted: Sun May 25, 2003 6:44 am
by volka
you might use the mysql command CONCAT(str1,str2,...) in your update-query.

Code: Select all

update tablename set fieldname=concat('myprefix_', fieldname) ...