sql with substring to a special character with sqlite

前端 未结 2 711
一生所求
一生所求 2021-01-16 18:39

I have values with following format in a table in sqlite:

AAAAAAAAAA#BBBBBBBBBB

AAAA#BBBBBBBBBB

AAAAAAAAAAAAAAAAA#BBBBBBBBBBB

I would lik

相关标签:
2条回答
  • 2021-01-16 18:51

    Never used sqlite but something along the lines of substr(yourfieldname, 1, instr(yourfieldname, '#') -1) should do it.

    0 讨论(0)
  • 2021-01-16 19:03

    Please try:

    SUBSTR(col,1,INSTR(col,'#') -1)
    

    Can be found at: http://www.sqlite.org/lang_corefunc.html

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