开发者

how to update a field which contains data using mysql

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.


update TableName set fieldName = CONCAT(fieldName, '3,4') where id = 1;


Following should do the trick:

UPDATE tablename SET columnname=concat(columnname,' my extra text');


By using UPDATE of course:

 UPDATE TABLENAME
 SET fieldName = "1,2,3,4"
 WHERE id = 1;

Assuming that fieldName is a string.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜