#查询
select t.TE_ID ,t.number , t.CREATION_DATE from pm_test t;
#置空
update pm_test set number="";
#截取复制
update pm_test set number = SUBSTRING_INDEX(CREATION_DATE,' ',1) ;
#替换
update pm_test set number=replace(number,'-','');
#拼接
update pm_test set number = CONCAT('CTGFCCS',number,TE_ID);
update pm_test set number = CONCAT('CTGFCCS',replace(SUBSTRING_INDEX(CREATION_DATE,' ',1),'-',''),TE_ID);
#mysql 同一个表里的字段内容添加到另一个字段
update table set col2=CONCAT(col2,':',col4);
replace(字段1,'c','C')
SUBSTRING_INDEX(district_cn,'/',3)
本文介绍了一系列MySQL数据库操作技巧,包括查询、更新字段内容的方法如置空、截取、替换及字符串拼接等,并展示了如何将一个表中的字段内容添加到另一个字段的具体实现。
2287

被折叠的 条评论
为什么被折叠?



