mysql> select * from topic;
+----+---------------------+-------+-------------+
| id | creatDate | title | category_id |
+----+---------------------+-------+-------------+
| 1 | 2011-12-08 11:03:32 | t0 | 1 |
| 2 | 2011-12-08 11:03:32 | t1 | 1 |
| 3 | 2011-12-08 11:03:32 | t2 | 1 |
| 4 | 2011-12-08 11:03:32 | t3 | 1 |
| 5 | 2011-12-08 11:03:32 | t4 | 1 |
| 6 | 2011-12-08 11:03:32 | t5 | 1 |
| 7 | 2011-12-08 11:03:32 | t6 | 1 |
| 8 | 2011-12-08 11:03:32 | t7 | 1 |
| 9 | 2011-12-08 11:03:32 | t8 | 1 |
| 10 | 2011-12-08 11:03:32 | t9 | 1 |
+----+---------------------+-------+-------------+mysql> select * from topic where id >= 5.5;
+----+---------------------+-------+-------------+
| id | creatDate | title | category_id |
+----+---------------------+-------+-------------+
| 7 | 2011-12-08 11:03:32 | t6 | 1 |
| 8 | 2011-12-08 11:03:32 | t7 | 1 |
| 9 | 2011-12-08 11:03:32 | t8 | 1 |
| 10 | 2011-12-08 11:03:32 | t9 | 1 |
+----+---------------------+-------+-------------+为什么没有id为6的记录?在Oracle中就没有这样的问题问题。如果有这样的BUG的话.select * from topic where id >= (select avg(id) from topic);
就肯定不行。相当于不能用avg()函数了。
有人遇见过吗?
+----+---------------------+-------+-------------+
| id | creatDate | title | category_id |
+----+---------------------+-------+-------------+
| 1 | 2011-12-08 11:03:32 | t0 | 1 |
| 2 | 2011-12-08 11:03:32 | t1 | 1 |
| 3 | 2011-12-08 11:03:32 | t2 | 1 |
| 4 | 2011-12-08 11:03:32 | t3 | 1 |
| 5 | 2011-12-08 11:03:32 | t4 | 1 |
| 6 | 2011-12-08 11:03:32 | t5 | 1 |
| 7 | 2011-12-08 11:03:32 | t6 | 1 |
| 8 | 2011-12-08 11:03:32 | t7 | 1 |
| 9 | 2011-12-08 11:03:32 | t8 | 1 |
| 10 | 2011-12-08 11:03:32 | t9 | 1 |
+----+---------------------+-------+-------------+mysql> select * from topic where id >= 5.5;
+----+---------------------+-------+-------------+
| id | creatDate | title | category_id |
+----+---------------------+-------+-------------+
| 7 | 2011-12-08 11:03:32 | t6 | 1 |
| 8 | 2011-12-08 11:03:32 | t7 | 1 |
| 9 | 2011-12-08 11:03:32 | t8 | 1 |
| 10 | 2011-12-08 11:03:32 | t9 | 1 |
+----+---------------------+-------+-------------+为什么没有id为6的记录?在Oracle中就没有这样的问题问题。如果有这样的BUG的话.select * from topic where id >= (select avg(id) from topic);
就肯定不行。相当于不能用avg()函数了。
有人遇见过吗?
+--------+--------+------+
| deptno | dname | loc |
+--------+--------+------+
| 1 | 销售部 | 北京 |
| 2 | 开发部 | 上海 |
| 3 | 人事部 | 杭州 |
| 4 | 行政部 | 郑州 |
| 5 | 销售部 | 上海 |
+--------+--------+------+
5 rows in set (0.00 sec)mysql> select * from dept where deptno >=3.5;
+--------+--------+------+
| deptno | dname | loc |
+--------+--------+------+
| 4 | 行政部 | 郑州 |
| 5 | 销售部 | 上海 |
+--------+--------+------+
2 rows in set (0.00 sec)测试正常啊你的ID什么类型 char ?
mysql> desc topic;
+-------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| creatDate | datetime | YES | | NULL | |
| title | varchar(255) | YES | | NULL | |
| category_id | int(11) | YES | MUL | NULL | |
+-------------+--------------+------+-----+---------+----------------+
id >= 5.5 id >= 5.6就有问题了。你试的跟我一样吗?
我同学的是5.5.18的。都出现了这个问题。
(Current Generally Available Release: 5.5.19)
官方才出到5.5.19吧?哥们
不管主键还是非主键。都对