1、自己解决更好; 2、MYSQL进行了转换; 3、 select * from mytable where upRange>=+7.00 select * from mytable where upRange <=-7.00ORselect * from mytable where 0+upRange>=+7.00 select * from mytable where 0-upRange <=-7.00
在MYSQL HELP中有说明,MYSQL自己进行了转换 select * from mytable where 0+upRange>=+7.00 select * from mytable where 0-upRange <=-7.00When an operator is used with operands of different types, type conversion occurs to make the operands compatible. Some conversions occur implicitly. For example, MySQL automatically converts numbers to strings as necessary, and vice versa. mysql> SELECT 1+'1'; -> 2 mysql> SELECT CONCAT(2,' test'); -> '2 test'
select * from mytable where upRange<=-7.00
FROM mytable
WHERE upRange IS NOT NULL
AND (CAST(upRange AS SIGNED) >= 7
OR CAST(upRange AS SIGNED) <= -7);
select * from mytable where upRange <=-7.00
这样也行啊
mysql> select 1+'1','1'+'1',2>'1';
+-------+---------+-------+
| 1+'1' | '1'+'1' | 2>'1' |
+-------+---------+-------+
| 2 | 2 | 1 |
+-------+---------+-------+
1 row in set (0.16 sec)mysql>
若要在数值语境中将一个字符串派给一个数值, 通常情况下,除了将字符串值作为数字使用外,你不需要做任何事:mysql> SELECT 1+'1'; -> 2若要在一个字符串语境中使用一个数字,该数字会被自动转化为一个BINARY 字符串。mysql> SELECT CONCAT('hello you ',2); -> 'hello you 2'
11.2.2. Type Conversion in Expression Evaluation
2、MYSQL进行了转换;
3、
select * from mytable where upRange>=+7.00
select * from mytable where upRange <=-7.00ORselect * from mytable where 0+upRange>=+7.00
select * from mytable where 0-upRange <=-7.00
select * from mytable where 0+upRange>=+7.00
select * from mytable where 0-upRange <=-7.00When an operator is used with operands of different types, type conversion occurs to make the operands compatible. Some conversions occur implicitly. For example, MySQL automatically converts numbers to strings as necessary, and vice versa. mysql> SELECT 1+'1';
-> 2
mysql> SELECT CONCAT(2,' test');
-> '2 test'