关于数据库更新的一个问题

来源:百度知道 编辑:UC知道 时间:2024/05/14 03:23:29
如何在保留数据库原来数据的情况下更新数据库[字段]中的某个[值]。
比如该字段已经存在数据"com,admin"
我想要再这个基础上添加一个值变成"com,admin,super"
一楼的做法,还是全部更新了啊,没保留原来的数据。

update tabname
instrat into coinema ='super'
where coiname is null

update TabName
set ColName="super"
where ColName is NULL;
这样并不是全部更新,只是把没有数值的字段更新了

update 表名 set ColName = ColName ||'你要添加的值'

update table1 set col1 = col1 + ',super' where col1 = 'com,admin'

col1 + ',super'
col1是原来的列内容,',super' 是要添加的内容
col1 = 'com,,admin'是条件

就是把原来内容是'com,,admin'的改成'com,admin,super'