MySQL append string

Use a combination of CONCAT and IFNULL (to handle the NULL case):

UPDATE `table`
   SET `City` = IFNULL(CONCAT(`City`, " Tokyo"), "Tokyo")
WHERE `ContactName` = "Maria Anders";

However, appending seems wrong. If you want multiple City values (a many-to-many relationship), you should have a separate table for cities and a separate table for person-city relationships. Read about database normalisation.

Leave a comment