Adding data to row without replacing existing data
I have a column in a row with value 'White' and want to update it to 'Not White'. The following query will change the value from 'White' to 'Not White' i.e.
Now the column will have the value 'Not White'.
And if I want to append the new value at the end, change the parameters order in the CONCAT() function.
- UPDATE table SET
- color = CONCAT( 'Not ', color)
- WHERE id=1
And if I want to append the new value at the end, change the parameters order in the CONCAT() function.
- UPDATE table SET
- color = CONCAT( color, ' Not')
- WHERE id=1
Now the column will have the value 'White Not'.