从mysql字段中删除第一个字符 [英] remove first character from mysql field
本文介绍了从mysql字段中删除第一个字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要一些建议,以便在我的值列表中进行处理.我有一个表llx_societe
和一些字段,其中一个是code_client
.该字段如下所示:
I need advices in order to make a process on my list of values. I have a table llx_societe
and some fields where one of them is code_client
. This field looks like :
0099
00100
00101
00102
...
00998
00999
001000
我想删除00100
和00999
之间所有值的第一个零,以便获得0100
直到0999
.
I want to remove the first zero for all values between 00100
and 00999
in order to get 0100
until 0999
.
我写了这个命令:
UPDATE `llx_societe`
SET `code_client`= SUBSTR(code_client,1)
WHERE `code_client` BETWEEN '00100' AND '00999';
但是什么也没有,没有一行可以继续.
But nothing, none lines are proceed.
您有解释吗?
推荐答案
SQL从1开始计数,而不是从0开始计数.
SQL starts counting from 1 and not 0. Try this:
UPDATE `llx_societe`
SET `code_client`= SUBSTR(code_client,2)
WHERE `code_client` BETWEEN '00100' AND '00999';
这篇关于从mysql字段中删除第一个字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文