|
Pages: [1] |  |
|
|
Author
|
Topic: MySql - Add to text field in update statement (Read 2356 times)
|
 Joined: Oct 2007 Posts: 55
 
 United States
|
Dec 01, 2007, 01:21:26 PM | #1 |
I want to know if this syntax is correct before I try anything. I have a field with info in it all ready and I want to add a string to every entree. Is this correct syntax. if not what is. I couldn't find it in the docs.
update table set field = field + 'this is the string';
anyone?? |
|
|
|
| |
|
|
|
 Joined: Oct 2007 Posts: 55
 
 United States
|
Dec 01, 2007, 05:12:43 PM | #3 |
| thanks for the reply but I'm trying to update all records in my database that's why there is no WHERE in my statement. |
|
|
|
|
    Joined: Jan 2006 Posts: 6215
Administrator
 
 United States
|
Dec 02, 2007, 03:09:29 AM | #4 |
To concatenate a string in MySQL, you need to use the concat function....
update table set field = concat(field, 'this is the string')
The function is "overloaded" so you can concat as many values as you want to like this...
update table set field = concat(field, 'this is the string', 'string2', 'string3', string4')
|
|
Latest Blog Post :
8 Tips for Creating a Marketing Buzz
|
|
|
 |
|
Pages: [1]
|
|
|
 |