Let say I have this table
id a b
1 data 1234
2 data
I want to concat with separator (but) if no data, don't add the separator.
If I do
UPDATE `table` SET `b` = CONCAT_WS(',',`b`,'newData') WHERE `id` = '1'
I get the expected 1234,newData in b
but I I do
UPDATE `table` SET `b` = CONCAT_WS(',',`b`,'newData') WHERE `id` = '2'
I get ,newData in b
(( but I want only newData without the separator )).
IS there a way to do this ?