语法:update table_name t set t.row_name=replace(t.row_name,'old_value','new_value')
注:table_name 表名; row_name 被更新的列名; old_value 要被更新的值; new_value 更新的新值
例如:将content里的www,替换为'http://file.resources.tt.515best.com的语句如下:
update tl_lanb11_content t set t.content=replace(t.content,'www','http://file.resources.tt.515best.com') where t.nb_content_id=49976
注:table_name 表名; row_name 被更新的列名; old_value 要被更新的值; new_value 更新的新值
例如:将content里的www,替换为'http://file.resources.tt.515best.com的语句如下:
update tl_lanb11_content t set t.content=replace(t.content,'www','http://file.resources.tt.515best.com') where t.nb_content_id=49976
本文介绍了一种使用SQL语句中的replace函数来更新数据库表中特定字段值的方法。通过一个具体的例子展示了如何将表tl_lanb11_content中的某一行content列中的'www'替换为'http://file.resources.tt.515best.com'。
3174

被折叠的 条评论
为什么被折叠?



