admin管理员组文章数量:1564631
下面讲到的语法,当时的使用场景是要移动树中的节点时,要修改该节点以及其子节点的所有父节点(parentids)。
update trainstaff_dept set parentids = replace(parentids,#{oldPId},#{newPId}) where companyid=#{companyId}
and id=#{Id}
update trainstaff_dept set parentids=concat(#{newPId},substring(parentids,#{length}+1)) where substring(parentids,1,#{length})=#{oldPId} and companyid=#{companyId};
substring(filed,m):截取filed字段从第m个字符开始到结束的字符串;
substring(filed,m,n):截取filed字段从第m个字符开始的长度为n的字符串;
cancat(string1,sting2,……):将string1、string2, ……字符串连接起来。
replace(parentids,#{oldPId},#{newPId})
parentids:需要替换的字段
oldPId:老的字符串
newPId:新的字符串
本文标签: 函数Contactmysqlreplacesubstring
版权声明:本文标题:mysql contact 函数_mysql(substring函数,contact函数以及replace函数的使用) 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/dianzi/1726640193a1079559.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论