replace,concat,length,INSTR,SUBSTR函数(动态更新数据库的字段的值,比如1-2-3-4-5-6-,在后台传过来一个-1-,更新后的字段是2-3-4-5-6-)

 

SELECT
PRESERVE03,
replace(concat( '-',PRESERVE03),'-1-', '-') as r,
concat( '-',PRESERVE03) as c,
length(replace(concat( '-',PRESERVE03),'-1-', '-')) as l,
INSTR(PRESERVE03,'1q') as i,
SUBSTR(PRESERVE03,2) as s,
SUBSTR( replace(concat( '-',PRESERVE03),'-1-', '-'), INSTR(replace(concat( '-',PRESERVE03),'-1-', '-'),'-') + 1,100 ) as ll

FROM T_CADRE_PROCESS_MOTION

 

posted @ 2018-12-18 15:44  程序员小明1024  阅读(360)  评论(0编辑  收藏  举报