修改单条数据:

UPDATE 'tgs_code' SET 'bianhao' = '1688', WHERE 'tgs_code'. 'id'= 15;

‘tgs_code’ :数据表
‘bianhao’:表名称
‘1688’:要更改的数据
WHERE:在哪一个表内

批量修改

UPDATE `tgs_code` SET `id`= `id` WHERE 1.

批量修改某个字符

update table set Name=REPLACE(Name,'市','') where Name like '%市%'

table:修改的数据表 Name:数据表名称

replace REPLACE ( ‘string_expression1’ , ‘string_expression2’ , ‘string_expression3’ )
‘string_expression1’ 待搜索的字符串表达式。
‘string_expression2’ 待查找的字符串表达式。
‘string_expression3’ 替换用的字符串表达式。

举例 我要替换数据表code,数据列bianhao中所有空格,%%中间无任何字符与空格,表示在bianhao列中 查找(空格),替换为空。

update code set bianhao=REPLACE(bianhao,’ ‘,”) where bianhao like ‘%%’

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

%d 博主赞过: