tags:

views:

22

answers:

3

Hi all,

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.

A: 

By using UPDATE of course:

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

Assuming that fieldName is a string.

vtorhonen
+2  A: 
update TableName set fieldName = CONCAT(fieldName, '3,4') where id = 1;
Vash
thanks vash. This is what i exactly want. Thanks a lot man
Fero
@Fero: Cool, but set some answer as accepter to remove it from unanswered section ;-).
Vash
*accepted [15 character in length]
Vash
+1  A: 

Following should do the trick:

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

YoK
Sorry by the time I added similar answer was already posted :(.
YoK
thanks yok. u r right.
Fero
But you are right yogesh. Cheers and thanks a lot
Fero