mysql字符串截取

1、left(str,index) 从左边第index开始截取

2、right(str,index)从右边第index开始截取

3、substring(str,index)当index>0从左边开始截取直到结束  当index<0从右边开始截取直到结束  当index=0返回空

4、substring(str,index,len) 截取str,从index开始,截取len长度

5、substring_index(str,delim,count),str是要截取的字符串,delim是截取的字段 count是从哪里开始截取(为0则是左边第0个开始,1位左边开始第一个选取左边的,-1从右边第一个开始选取右边的

6、subdate(date,day)截取时间,时间减去后面的day

7、subtime(expr1,expr2)  时分秒expr1-expr

参考自:https://www.cnblogs.com/shuaiandjun/p/7197450.html?utm_source=itdadao&utm_medium=referral

猜你喜欢

转载自www.cnblogs.com/watermelon-cmj/p/9256219.html