Page 1 of 1

adding information onto the end of a value in a field

Posted: Sat Nov 02, 2002 10:11 am
by DynamiteHost
hi,

say if i had fieldname and fieldname contained "value", i want to keep "value" and add ",value2" on to it.

would I have to select the information and put it into the new value or is there anyother quicker method?

Posted: Sat Nov 02, 2002 11:03 am
by mydimension
yep, use the CONCAT_WS function: http://www.mysql.com/doc/en/String_func ... ml#IDX1163

Code: Select all

CONCAT_WS(",", column_value, "value2")
just use that as the value you want to insert/update

Code: Select all

INSERT INTO table SET column_name=CONCAT_WS(",", column_name, "value2")
i haven't tested this but according to the manual it should work.