您的位置:首页 > 数据库 > MySQL

mysql 更新某个字段的部分内容

2010-12-20 16:40 337 查看
语法: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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: