Arithmetic results in a value of zero but mysql is
treating the value as > 0. This is reproducible in a
lot of different ways. Below is a pretty clear
example.

mysql> select version();
+---------------+
| version()     |
+---------------+
| 4.0.17-max-nt |
+---------------+
1 row in set (0.00 sec)

mysql> create table t (a decimal(12,2) not null, b
decimal(12,2) not null, c decimal(12,2) not null);
Query OK, 0 rows affected (0.72 sec)

mysql> insert into t values (260.22,18.81,279.03);
Query OK, 1 row affected (0.00 sec)

mysql> select a+b-c from t where a+b-c = 0;
Empty set (0.00 sec)

mysql> select a+b-c as y from t having y = 0;
Empty set (0.00 sec)

mysql> select a+b-c as y from t having y > 0;
+------+
| y    |
+------+
| 0.00 |
+------+
1 row in set (0.00 sec)

mysql> select a+b-c from t where a+b-c > 0;
+-------+
| a+b-c |
+-------+
|  0.00 |
+-------+
1 row in set (0.00 sec)

Anybody?

Thanks, 

Dan.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to