在mysql中使用null值更新concat文本

时间:2012-06-25 10:23:47

标签: mysql

事务表描述字段有一些值,它工作正常。 description字段的默认值为NULL,它不起作用..

update transaction set domain='hiox.com',description=CONACT(description,',domain swapped from hioxindia.com to hiox.com') where id=23602

帮帮我......

1 个答案:

答案 0 :(得分:10)

使用ifnull()

update `transaction` 
   set domain='hiox.com',
   description=CONCAT(ifnull(description, ''), ',domain swapped from hioxindia.com to hiox.com') 
where id=23602

Documentation