I need to UPDATE tablename (col1name)
If there is already data, I need to append it with values \'a,b,c\' If it is NULL, I need to add the values \'a,b,c\'
I
You can use the following:
update yourtable
set yourcol = case when yourcol is null then 'a,b,c'
else concat(yourcol, ' a,b,c') end
See SQL Fiddle with Demo
Sample data:
CREATE TABLE yourtable(`yourcol` varchar(50));
INSERT INTO yourtable(`yourcol`)
VALUES ('sadsdh'),
(NULL);
Will return:
| YOURCOL |
----------------
| sadsdh a,b,c |
| a,b,c |