请教MYSQL精度问题
大家好,请教个问题:
mysql> SELECT 1093663.00-1093662.99;
+-----------------------+
| 1093663.00-1093662.99 |
+-----------------------+
| 0.01 |
+-----------------------+
1 row in set (0.00 sec)
mysql> SELECT 1093663.00-1093662.99=0.01;
+----------------------------+
| 1093663.00-1093662.99=0.01 |
+----------------------------+
| 0 |
+----------------------------+
1 row in set (0.00 sec)
这是为什么呢?两个数相减的结果显示0.01。可是用等号去比的时候,却显示不相等了?
mysql> select version();
+-----------+
| version() |
+-----------+
| 4.0.16 |
+-----------+
1 row in set (0.00 sec)
------解决方案--------------------
SELECT 1093663.00-1093662.99=0.01;
这个中你没有加()啊。
------解决方案--------------------
奇怪:
SELECT (1093663.00-1093662.99)=0.01;
我这执行怎么就返回 '1'呢