How to use alphanumeric fields with BETWEEN clause in Mysql?

前端 未结 3 831
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-26 10:44

I have a table that contain a field names as mgrs, the value that stored in mgrs fields is like \'42SWC227821555\' may contain more charachters, and may contain lower case lette

3条回答
  •  -上瘾入骨i
    2021-01-26 11:05

    Instead of BETWEEN clause use STRCMP(expr1, expr2) function for string comparison operations:

    WHERE STRCMP(mgrs, '42SWC227821555') >= 0 AND STRCMP(mgrs, '42SWC227821570') <= 0
    

提交回复
热议问题