mysql concat,substring用法
在工作中碰到一个Mysql字段更新问题
在custom表中有一个tariffurl的值中有如下情况:
uploadfiles ariff2007031172720306698.jpg以及uploadfiles ariff2007031172720306690.jpg;uploadfiles ariff2007031172720306691.jpg形式
要更改成uploadfiles/tariff/200703/1172720306698.jpg及 uploadfiles/tariff/200703/1172720306690.jpg;uploadfiles/tariff200703/1172720306691.jpg 形式
可以综合利用substring函数和cancat函数来实现,步骤如下:
1、 update custom set tariffurl=concat('uploadfiles/tariff/200703/',substring(tariffurl,24)) where tariffurl like 'uploadfiles ariff200703%'
2、update custom set tariffurl=concat(substring(tariffurl,1,55),'/tariff/200703/',substring(tariffurl,68))
where tariffurl like 'uploadfiles/tariff/200703/%' and tariffurl like'%;uploadfiles %'
substring(filed,m):截取filed字段从第m个字符开始到结束的字符串;
substring(filed,m,n):截取filed字段从第m个字符开始的长度为n的字符串;<-------MSSQL
cancat(string1,sting2,……):将string1、string2, ……字符串连接起来。
相关文档:
Real example:
/*************************by garcon1986*********************************************************/
<?php
// get the values from entreprise creation form
$secteur = $_POST['secteur'];
$nom = $_POST['nom_entreprise'];
$taille = $_POST['taille_entreprise'];
$concurrent = $_POST[' ......
http://book.51cto.com/art/200803/68118.htm
摘要:《深入浅出MySQL——数据库开发、优化与管理维护》从数据库的基础、开发、优化、管理4方面对MySQL进行了详细的介绍,其中每一部分都独立成篇,每一篇又包括多个章节。本书面向实用,内容覆盖广泛,讲解由浅入深,适合于各个层次的读者。
第20章 锁问题
锁是 ......
第一招、mysql服务的启动和停止
net stop mysql
net start mysql
第二招、登陆mysql
语法如下: mysql -u用户名 -p用户密码
键入命令mysql -uroot -p, 回车后提示你输入密码,输入12345,然后回车即可进入到mysql中了,mysql的提示符是:
mysql>
注意,如果是连接到另外的机器上,则需要加入一个参数-h机 ......
The vs2008 and vs2010 don't support the generation LINQ to SQL business objects from a MySQL database, if you drop a MySql table to a Linq to Sql Class, it will popup a "The selected object(s) use an unsupported data provider" error.
Generation tool DBLinq
DbLinq is a LINQ to SQL data co ......
只导创建表的结构:
bin/mysqldump -d --add-drop-database=FALSE --add-drop-table=FALSE -usosodb -p sosodb TEST > /tmp/test.sql
只导单行的INSERT语句:
bin/mysqldump --extended-insert=FALSE --add-drop-database=FALSE --add-drop-table=FALSE --create-options=FALSE -t --add-locks=FALSE -usosodb -p so ......