Reputation: 13315
I need to update a field which contains data.
For ex:
id fieldName
1 1,2
Now, I am getting 3,4 as another result which should be updated in id 1. That is now my result should be,
id fieldName
1 1,2,3,4
How can this be done using mysql.
Thanks in advance.
Upvotes: 0
Views: 91
Reputation: 14505
Following should do the trick:
UPDATE tablename SET columnname=concat(columnname,' my extra text');
Upvotes: 1
Reputation: 30865
update TableName set fieldName = CONCAT(fieldName, '3,4') where id = 1;
Upvotes: 2
Reputation: 2377
By using UPDATE of course:
UPDATE TABLENAME
SET fieldName = "1,2,3,4"
WHERE id = 1;
Assuming that fieldName is a string.
Upvotes: -1