数据库中有一列字符串,如下
100,1,1,0,0
100,1,2,0,0
100,2,3,4,2
...希望将前面的100修改为1,如下:
1,1,1,0,0
1,1,2,0,0
1,2,3,4,2
...求sql,谢谢!
100,1,1,0,0
100,1,2,0,0
100,2,3,4,2
...希望将前面的100修改为1,如下:
1,1,1,0,0
1,1,2,0,0
1,2,3,4,2
...求sql,谢谢!
update tt set f1=concat('1',mid(f1,instr(f1,'100,')+4))
or
update tt set f1=replace(f1,'100','1')
mysql> select replace('100,1,1,0,0',100,1);
+------------------------------+
| replace('100,1,1,0,0',100,1) |
+------------------------------+
| 1,1,1,0,0 |
+------------------------------+
1 row in set (0.00 sec)
where 有一列字符串 like '100,%'
update fun_build set base_msg = concat('100',substr(base_msg,3) where player_id = 'hao' and sub_type = 28;