Can anyone explain the following results to me?
I am trying to find all values +/- 30% from a number...
value is declared as: | value | int(10) unsigned
Note that 1.3*63000 is 81900...
The first two are apparently correct:
mysql> SELECT count(*) FROM bench WHERE year = 95 and
-> value >= .7*63000 and value <= 1.3*63000 ;
+----------+
| count(*) |
+----------+
| 115 |
+----------+
1 row in set (0.10 sec)
mysql> SELECT count(*) FROM bench WHERE year = 95 and
-> value >= .7*63000 and value <= 81900 ;
+----------+
| count(*) |
+----------+
| 115 |
+----------+
1 row in set (0.08 sec)
These next two should give the same result, but...
mysql> SELECT count(*) FROM bench WHERE year = 95 and
-> value BETWEEN .7*63000 and 81900 ;
+----------+
| count(*) |
+----------+
| 47 |
+----------+
1 row in set (0.08 sec)
mysql> SELECT count(*) FROM bench WHERE year = 95 and
-> value BETWEEN .7*63000 and 1.3*63000 ;
+----------+
| count(*) |
+----------+
| 0 |
+----------+
1 row in set (0.08 sec)
Thanks
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php