- 在数据库批量修改字符串的值,语句如下
update jc_content_picture set img_path="/jeecms"+img_path where 1=1
- 执行后提示如下
err 1292 - Truncated incorrect DOUBLE value: 'jeecms'
- 解决:
在sql语句进行字符串拼接时,不是我们习惯的使用“+”,而是使用mysql自带的字符拼接 函数concat(str1,str2,...),将上面sql改为
update jc_content_picture set img_path=CONCAT("/jeecms",img_path) where 1=1;
可以正常执行