MySql query BETWEEN two Strings sometimes doesn't work

前端 未结 1 940
逝去的感伤
逝去的感伤 2021-01-16 01:30

I have a mysql query where a subquery is:

BETWEEN \'5.00\' AND \'10.00\' 

And this returns no results.

However when I use Floats o

相关标签:
1条回答
  • 2021-01-16 02:10

    There is a difference between strings and integers -- there is a reason why you have several different datatypes :

    When comparing integers, you are comparing their numerical values ; i.e. 10 is bigger than 5.

    When comparing strings, you are using an alphabetical comparison ; i.e. '10' is smaller than '5', because '1' is smaller than '5'.

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