remove first character from mysql field

后端 未结 3 1836
迷失自我
迷失自我 2021-01-12 12:39

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 f

相关标签:
3条回答
  • 2021-01-12 13:26

    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';
    
    0 讨论(0)
  • 2021-01-12 13:31

    You can use the following SQL: UPDATE TABLENAME SET data = SUBSTR(FIELD, 2);
    for example if there is table(userinfo) and field is username

    UPDATE users SET username = SUBSTR(username, 2);

    0 讨论(0)
  • 2021-01-12 13:35

    Try this:

      UPDATE llx_societe
        SET code_client= SUBSTR(code_client, 2) 
        WHERE code_client between '00100' AND '00999'
    

    MySQL SUBSTR() function

    0 讨论(0)
提交回复
热议问题