Reputation: 1901
In my database, we have a column called deleteList
which holds comma separated values. How can I append values to an existing record in the database?
Upvotes: 4
Views: 2318
Reputation: 263733
you need to UPDATE the second time if you want to concatenate the values.
UPDATE tableName
SET deleteList = CONCAT(deleteList, ',', 'NEWVALUE')
WHERE colName = val
where
NEWVALUE
is the value you want to add on the list colName
is the key that identifies the row to be updated.Upvotes: 6