mysql match string with start of string in table

后端 未结 2 478
梦毁少年i
梦毁少年i 2021-01-07 19:34

I realise that it would be a lot easier if I could modify the table when it was created, but assuming I can\'t, I have a table that is such as:

abcd
abde
abd         


        
2条回答
  •  礼貌的吻别
    2021-01-07 20:17

    LIKE can be avoided, by truncating the comparison string to each value's length:

    ... WHERE LEFT('abffagpokejfkjs', LENGTH(value)) = value
    

提交回复
热议问题